Я использую одну из новых функций iOS 5 для UIAlertView. Я создаю UIAlertView, как это:
UIAlertView *scanCode = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Some Title", @"") message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:NSLocalizedString(@"OK", @""), nil];
[scanCode setAlertViewStyle:UIAlertViewStylePlainTextInput];
scanCode.tag = 1234;
[scanCode show];
[scanCode release];
Делегат, которым я пользуюсь сейчас:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == 1234) {
if (buttonIndex == 1)
{
//do something
}
}
}
}
Теперь я хочу смоделировать клавишу ввода, поэтому, когда пользователь нажимает клавишу возврата, на клавиатуре происходит то же самое, когда нажимается кнопка OK оповещения. Как я могу это сделать?
Заранее спасибо!