Your class needs to implement the UITextFieldDelegate
to get the keyboard return callback. As suggested by borrden, this can be done as follows
[message textFieldAtIndex:0].delegate = self;
Then implement this method,
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
// Dismiss the alert view
// Initiate the search
return YES;
}
Use this UIAlertView
method. Refer Apple docs
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
Call this on your alert view instance when required to dismiss it programmatically. You would require to keep message
as an ivar to access it when required.
Hope that helps!