带有 UITextField 的 UIAlertView 在 iOS 7 中不起作用。如何解决?
这是屏幕截图:
这是我的代码:
如何在 iOS7 的 UIAlertView 中获取 UITextFeield ?
-(void)takeUserName
{
mChangePlayerAlert = [[UIAlertView alloc] init];
mChangePlayerAlert.title = title;
mChangePlayerAlert.message = @"\n";
mChangePlayerAlert.delegate = self;
[mChangePlayerAlert addButtonWithTitle:@"Save"];
[mChangePlayerAlert addButtonWithTitle:@"Cancel"];
CGRect frame;
frame = CGRectMake(20, 45, 245, 27);//(200, 500, 400, 120);
mTextFeild = [[UITextField alloc] initWithFrame:frame];
mTextFeild.textColor = [UIColor blueColor];
mTextFeild.borderStyle = UITextBorderStyleRoundedRect;
mTextFeild.keyboardType = inType;//;
mTextFeild.returnKeyType = UIReturnKeyDone;
mTextFeild.autocorrectionType = UITextAutocorrectionTypeNo;
mTextFeild.autocapitalizationType = UITextAutocapitalizationTypeNone;
mTextFeild.delegate = self;
[mChangePlayerAlert addSubview:mTextFeild];
mTextFeild.delegate = self;
[mTextFeild becomeFirstResponder];
[mChangePlayerAlert show];
}