gpt4 book ai didi

带有文本字段的 iphone alertview

转载 作者:太空狗 更新时间:2023-10-30 03:38:55 24 4
gpt4 key购买 nike

我有一个 UIAlertView,里面有一个 UITextField。我想输入 ma​​il id 并在 UIAlertViewok 按钮中提交,但是 UITextFieldUIAlertView 没有响应,请帮助我。

谢谢

最佳答案

从 iOS 5 开始,不再需要上述方法。只需将 alertViewStyle 属性设置为适当的样式(UIAlertViewStyleSecureTextInputUIAlertViewStylePlainTextInputUIAlertViewStyleLoginAndPasswordInput)。

例子:

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Email" message:@"Enter your email:" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
[alertView show];

您可以将响应返回为

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
UITextField *emailTextField = [alertView textFieldAtIndex:0];
NSLog(@"%@",emailTextField.text);
}

关于带有文本字段的 iphone alertview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5576031/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com