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

The search table does not disappear in iOS6 #27

Closed JanC closed 12 years ago

JanC commented 12 years ago

Hi, When I run the example on a iOS 6 (compiled for iOS 5.1), the search result table does not disappear when I select an entry

cheers ;)

thermogl commented 12 years ago

I don't have the iOS 6 beta installed - you're gonna have to solve this one yourself :)

JanC commented 12 years ago

ok, I'll have a look on that ;)

thanks for this library btw.

JanC commented 12 years ago

It looks like on a iOS 6 device, when the TokenField is deselected (UIControlEventEditingDidEnd), the selector for UIControlEventEditingChanged is not called whereas it is called on iOS 5.

The selector for this event is the one which hides the search table (tokenFieldTextDidChange:) hence why the table remains visible.

A simple workaround would be to explicitly call the hide method in the didSelectRowAtIndexPath:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    id representedObject = [resultsArray objectAtIndex:indexPath.row];
    TIToken * token = [tokenField addTokenWithTitle:[self displayStringForRepresentedObject:representedObject]];
    [token setRepresentedObject:representedObject];

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    // fix for iOS 6
    [self setSearchResultsVisible:NO];
}
thermogl commented 12 years ago

Looks good, I'll add it in shortly.