Re: UITextView as its own delegate - infinite loop on keyboard select
Re: UITextView as its own delegate - infinite loop on keyboard select
- Subject: Re: UITextView as its own delegate - infinite loop on keyboard select
- From: Kyle Sluder <email@hidden>
- Date: Sun, 28 Feb 2010 17:29:40 -0800
On Sat, Feb 27, 2010 at 6:37 PM, Roland King <email@hidden> wrote:
> Thanks that's what I see too. That thread doesn't explain why of course. I
> have a trivial test case so I'll file this as a bug and see what comes back
> because I think the behaviour is wrong. For now I'm using a different object
> as delegate, which isn't so neat but works fine.
The thread does explain exactly what's going on in the UITextField
case: it sends itself messages which are also sent to the delegate.
In your case, -[UITextView keyboardInputChangedSelection:] calls [self
textViewDidChangeSelection:], which in turn asks if [self.delegate
respondsToSelector:@selector(textViewDidChangeSelection:)], which
obviously returns YES, so it calls [self.delegate
textViewDidChangeSelection:]. Because self == delegate, you infinitely
recurse.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden