开发者

UITextView intercept calls to setSelectedRange?

If you tap a UITextView, the selectedRange property is set. I want to intercept that call and possi开发者_如何学Gobly change the location. Is there any way to do that?

I tried implementing

-(void) setSelectedRange: (NSRange) theRange 

in my subclass. This intercepts it just fine if I am setting the range. But if Apple's code is doing the setting (as happens with a tap), my subclass setSelectedRange method does not fire.

Thanks


Instances of UITextView send a -textViewDidChangeSelection: notification to their delegate whenever the selection changes, so you could implement that in your controller (don't forget to make it the text view's delegate of course), and have the controller manipulate the selectedRange property itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜