APTokenField icon indicating copy to clipboard operation
APTokenField copied to clipboard

Table view not dismissed before aftertokenFieldDidReturn:(APTokenField *)tokenField

Open sigmundfridge opened this issue 11 years ago • 2 comments

Hi, Great project. I hope it's still being supported. I am currently implementing it such that:

a) It works exactly in the demo (starting to type brings up a table, and tokens can be selected). b) typing into the field and clicking enter creates a new token

This kind of works but I've found two issues that I will raise as different issues.

The first is that when aftertokenFieldDidReturn is called the tableview doesn't disappear. So I can create a new tag, based on the text in the APTokenField, but a user can then click a table cell and crash the app. If anything else is typed into the field a new table is populated and there is no problem, it's only in the specific case of pressing enter whilst the tableview is shown.

I'm going to investigate the issue myself but thought I'd raise it here first just in case you're still supporting the project.

sigmundfridge avatar Oct 26 '13 00:10 sigmundfridge

And this is the simplest solution but I fear it might be too simple

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    if (!self.enabled)
    return NO;

   _resultsTable.hidden = YES;

   if ([_tokenFieldDelegate respondsToSelector:@selector(tokenFieldDidReturn:)])

    [_tokenFieldDelegate tokenFieldDidReturn:self];

  return YES;
}

sigmundfridge avatar Oct 26 '13 01:10 sigmundfridge

hi @sigmundfridge. It's been a long time since I've coded for iOS, so I'd have to take awhile to get re-acquainted with the code. However, if you find a solution to this issue and the other one you raised, I'd happily accept them as pull requests.

arashpayan avatar Nov 20 '13 17:11 arashpayan