Ich versuche, einen Textfield-Wert von UIAlertController zu bekommen, aber immer wenn ich versuche, den Wert (Name) einzugeben und auf label anzuzeigen, zeigt die Ausgabe nichts.IOS 9 - Wie bekomme ich einen Wert von textField in einem 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];
}
den yesButton Hantierungsbausteins für Textfeld Details auf dem Etikett Anzeige verwenden . –
@JP_Mob können Sie bitte einige Code teilen, indem Sie diese Frage beantworten, Vielen Dank für Ihre Zeit –