UIAlertView and UIActionSheet do not display properly in iOS 8

UIAlertView and UIActionSheet do not display properly in iOS 8, the view controller hides it, and the warning header is not displayed. I am running an application from Xcode 5.1.1.

Action sheet

Alert view

+5
source share
3 answers

You have added a category for ViewController to your application. as below

 @implementation UIViewController (CustomeAction) - (void)setTitle:(NSString *)title{ // YOU CODE/// } @end 

This may be a problem. I decided to remove this category - (void)setTitle:(NSString *)title.

Note. From iOS 8, the UIAlertViewController is inherited from the UIViewController. If you use the category method, this will affect the names of the UIAlertView and UIActionSheet.

You can reference Apple docs on the UIAlertController Class Link

+5
source

It should be noted that UIAlertView and UIActionSheet are deprecated in iOS 8. You can check this question or link to the apple . Maybe this will help you.

0
source

You can use the following code using UIAlerController for Xcode 6 and iOS 8

 UIAlertController * alert= [UIAlertController alertControllerWithTitle:@"Title" message:@"Your Message" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { [alert dismissViewControllerAnimated:YES completion:nil]; }]; UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { [alert dismissViewControllerAnimated:YES completion:nil]; }]; [alert addAction:ok]; [alert addAction:cancel]; [self presentViewController:alert animated:YES completion:nil]; 

For ActionSheet

 UIAlertController * alert= [UIAlertController alertControllerWithTitle:@"Title" message:@"Your Message" preferredStyle:UIAlertControllerStyleActionSheet]; 
0
source

Source: https://habr.com/ru/post/1203030/


All Articles