thermogl / TITokenField

An iOS version of the NSTokenField (See To: field in Mail and Messages).
http://thermoglobalnuclearwar.com/opensource/
599 stars 172 forks source link

- (void)didEndEditing gets called on tapping a token after 3rd row using multiple TITokenFieldViews #83

Open ObjectiveB opened 10 years ago

ObjectiveB commented 10 years ago

I'm adding the TITokenFieldViews (2-3 of them) one below another to a parent view. This is to achieve multiple token views (To/CC/Bcc etc.). But I get a strange behavior. In any TITokenFieldView, I start typing and the tokens get added properly. I'm able to tap and select a particular token on the first couple of lines. But on tapping to select a token on the 4th or 5th line (and so on), the TITokenFieldView contracts to "N recipients". The - (void)didEndEditing method is somehow fired when I tap a token on the 4th line (or above). Why is this happening?

ObjectiveB commented 10 years ago

If it helps, this issue happens even with a single TITokenFieldView. But I'm adding the TITokenFieldView as a subview to a webview.scrollView entity.

thermogl commented 10 years ago

I'm unable to replicate this with the example project, can you put together a project which demonstrates the issue for me?

ObjectiveB commented 10 years ago

I was able to reproduce it. It happens when the view hierarchy is this: TITokenFieldView as subview of a parent UIView "ABC". The parent UIView is then added as a subview of the overall webView.scrollView entity.

I tried removing the UIView "ABC" and added the TITokenFieldView as a direct subview to webView.scrollView. Now it works as intended, doesn't collapse. Was able to replicate this in your example project as well using the same view hierarchy as described above. Try adding the TITokenFieldView as a subview to a UIView which is then a subview to a web view's scrollview.

thermogl commented 10 years ago

So it works if you don't use a view between the TITokenFieldView and the UIWebView scrollview?

ObjectiveB commented 10 years ago

Yep. Works when there's no view in between, contracts on tapping tokens from line 3 or 4 onward when there's a view in between.

thermogl commented 10 years ago

And this view is just a standard UIView? No default property values have been changed (specifically to do with touch)?

ObjectiveB commented 10 years ago

Yeah, a plain vanilla UIView, just alloc init-ed and a frame set. Nothing set or changed w.r.t touch events.

thermogl commented 10 years ago

Weird weird weird. I'll have a poke around soon