iOS8 AlertViewController问题
我的iOS8 AlertViewController问题,ios8,uialertcontroller,Ios8,Uialertcontroller,我的viewController中有一个textField,当出现AlertViewController时,键盘不会出现在AlertViewController的后台。但在关闭AlertViewController后,键盘会出现。这种情况只发生在ios8设备上。以下是我的代码: [textField becomeFirstResponder]; if([self checkIfiOS8]) { // for iOS 8 UIAlertContro
viewController
中有一个textField
,当出现AlertViewController
时,键盘不会出现在AlertViewController的后台。但在关闭AlertViewController
后,键盘会出现。这种情况只发生在ios8设备上。以下是我的代码:
[textField becomeFirstResponder];
if([self checkIfiOS8])
{
// for iOS 8
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Your Title"
message:@"Your message" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { }];
[alert addAction:cancelAction];
[self presentViewController:alert animated:YES completion:nil];
}
else
{
// iOS7
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Your Title" message:@"Your message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"AlertView" message:@"I am an AlertView" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:defaultAction];
[self presentViewController:alert animated:YES completion:nil];