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'
并且:No visible @interface for 'UIAlertController' declares the selector 'initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:'
答案 0 :(得分:1)
宣布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];