当它在框架中可用时,我一直认为这个属性是未声明的。
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];
答案 0 :(得分: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];
答案 1 :(得分:0)
您是否正确实施了UIAlertViewDelegate的方法?
喜欢这个(没有重命名)?
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
答案 2 :(得分:0)
> alertView.alertViewStyle = UIAlertViewStylePlainTextInput; > [alertView textFieldAtIndex:0].keyboardType = UIKeyboardTypeNumberPad;