alertView 在iphone5.0上多了一些属性,不必自己重新加View,比如输入文字 ,密码,以及密码和文字
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
alertView.alertViewStyle = UIAlertViewStyleSecureTextInput; 等
如果你想要获得文本的值 可以使用
UITextField *textField = [alertView textFieldAtIndex:0];
NSLog(@”Plain text input: %@”,textField.text);
当然如果文本不只一个 索引是依次增加的
默认的button 第一个是cancel 索引值为0 其他依次类推
如果你想使其他的button 动态调整可用与否 可以使用
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView
{
UITextField *textField = [alertView textFieldAtIndex:0];
if ([textField.text length] == 0)
{
return NO;
}
return YES;
}