thermogl / TITokenField

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

Tokens became selected in tableView when the cell is reloaded #76

Closed CiraciNicolo closed 10 years ago

CiraciNicolo commented 10 years ago

I've a TITokenField in the contentView of a UITabelViewCell, when the table reload its data the tokens became selected.

Actually my code is something like this:

if (IHaveSomeValueFromTheTokensSaved) {

     add the tokens
     deselect the selected token
}

But I still have the tokens selected. It's a bug, or I'm missing something?

CiraciNicolo commented 10 years ago

And also the TokenView is scrollable inside a cell, how can I prevent this?

thermogl commented 10 years ago

Sounds like a bug - can you step through the various methods in debugging and see what's being called? Might shine some light on why tokens are being selected.

TITokenField is a UITextField, so it shouldn't scroll..?

CiraciNicolo commented 10 years ago

I found the problem (sorry for the delay): when the cell is redraw the TITokenField did't get the event for UIControlEventEditingDidEnd. I just edited the resignFirstResponder method, and call it before I add all the token.

- (BOOL)resignFirstResponder {
    [_tokenField sendActionsForControlEvents:UIControlEventEditingDidEnd];
    return [_tokenField resignFirstResponder];
}