0

当它应该在框架中可用时,我一直将这个属性设为未声明。

UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Email Alert" message:@"Enter your Email Address" delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:nil];
[alert setAlertViewStyle:UIAlertViewStyleSecureTextInput];
[alert show];
[alert release];
4

3 回答 3

1

我以这种方式使用了 UIAlertViewStylePlainTextInput。请根据需要修改代码。

                 alertType = @"phoneNumberAlert";
                 UIAlertView *phoneNumberAlert = [[UIAlertView    
                 alloc]initWithTitle:@"Notice"     
                 message:@"Please enter your Phone Number" delegate:self 
                 cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
                 [phoneNumberAlert setAlertViewStyle:UIAlertViewStylePlainTextInput];
                 UITextField *alertTextField = [phoneNumberAlert textFieldAtIndex:0];
                 alertTextField.keyboardType = UIKeyboardTypeNumberPad;
                 [phoneNumberAlert show];
                 [phoneNumberAlert release];
于 2013-01-04T18:50:00.033 回答
0

您是否正确实现了 UIAlertViewDelegate 的方法?

喜欢这个(不重命名)?

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
于 2013-01-04T16:09:08.400 回答
0
> alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
>     [alertView textFieldAtIndex:0].keyboardType = UIKeyboardTypeNumberPad;
于 2013-04-11T14:57:33.687 回答