2
由于UIAlertController
用于显示iOS8.my应用程序中的警报应与ios6,ios7兼容。我认为ios6,7仍在使用UIAlertView
来显示警报。 我想通过不同的方式检查ios6,7,8后显示警报,例如使用UIAlertView
的ios7和使用UIAlertController
的ios8。我需要objectiv -c代码。使用iOS7,iOS8显示警报
请帮忙!!
在此先感谢!
由于UIAlertController
用于显示iOS8.my应用程序中的警报应与ios6,ios7兼容。我认为ios6,7仍在使用UIAlertView
来显示警报。 我想通过不同的方式检查ios6,7,8后显示警报,例如使用UIAlertView
的ios7和使用UIAlertController
的ios8。我需要objectiv -c代码。使用iOS7,iOS8显示警报
请帮忙!!
在此先感谢!
检查如果类是可用
if ([UIAlertController class]){
// ios 8 or higher
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Alert title" message:@"Alert message" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:ok];
[self presentViewController:alertController animated:YES completion:nil];
} else {
// ios 7 or lower
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"Alert title" message:@"Alert message" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
谢谢@jcesarmobile! – 2014-10-07 07:24:03
http://stackoverflow.com/questions/7848766/how-can-we-programmatically-detect-which-ios-version-is-device-running-在 – Signo 2014-10-07 07:04:16