UIAlertController *alert = [[UIAlertController alloc] initWithTitle: alertString message:nil
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
我遇到了这个错误:
No visible @interface for 'UIAlertController' declares the selector 'show'
还有这个:
‘UIAlertController’没有可见的@interface声明选择器‘initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:’
声明步骤正确
UIAlertController
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
// add action button
UIAlertAction *okAction = [UIAlertAction actionWithTitle:actionTitle style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:okAction]; // add action button to alert controller
// present alert controller in view
[self presentViewController:alertController animated:YES completion:nil];