wagashi
wagashi

Reputation: 894

ios simulate press done/return

I dont want to hide keyboard, but simulate tapping done/return key type, so it will call one of my functions.

UITextFieldInputTraits?

I appreciate if you could direct me in right way.

Upvotes: 1

Views: 1423

Answers (1)

Eugene
Eugene

Reputation: 10045

Use UITextField delegate method:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
  [self myFoo];
  return NO;
}

if you need to simulate tapping return call this function like:

[self textFieldShouldReturn:nil];

Upvotes: 2

Related Questions