Я пытаюсь получить значение TextField от UIAlertController, но всякий раз, когда я пытаюсь ввести значение (Name) и отображать его на этикетки, выход не показывает ничего.IOS 9 - Как получить значение textField в UIAlertController?
- (IBAction)button:(id)sender {
UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Test" message:@"Please Enter your name " preferredStyle:UIAlertControllerStyleAlert];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Person Name ";
textField.textColor = [UIColor blueColor];
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.secureTextEntry = NO;
}];
UIAlertAction* yesButton = [UIAlertAction
actionWithTitle:@"ENTER, please"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
//Handle the ENTER button
// how to Display the name in the label
}];
UIAlertAction* noButton = [UIAlertAction
actionWithTitle:@"No, thanks"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
//Handle no button.
}];
[alert addAction:yesButton];
[alert addAction:noButton];
[self presentViewController:alert animated:YES completion:nil];
}
использовать блок обработчика yesButton для деталей отображения TextField на этикетке , –
@JP_Mob пожалуйста, вы можете поделиться кодом, отвечая на этот вопрос, спасибо за ваше время –