ios - error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector -
app crashed in 2nd nslog line.
debug statement: (lldb) po textview.superview error: execution interrupted, reason: attempted dereference invalid objc object or send unrecognized selector. process has been returned state before expression evaluation. (lldb)
can tell me problem.
- (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context { if ([keypath isequaltostring:alertcontentsizekeypath]) { uitextview * textview = object; nslog(@"textview :: %@", textview); nslog(@"bounds :: %f", [textview bounds].size.height); cgfloat topcorrect = ([textview bounds].size.height - [textview contentsize].height * [textview zoomscale])/2.0; topcorrect = ( topcorrect < 0.0 ? 0.0 : topcorrect ); textview.contentoffset = (cgpoint){.x = 0, .y = -topcorrect}; } } thanks
Comments
Post a Comment