UIActionSheet not showing in iOS 8

I can show ActionSheet in iOS 7, but I can’t show in iOS 8. Is there a way to track?

UIActionSheet *_actionSheet = [[UIActionSheet alloc] initWithTitle:@"Account" delegate:self cancelButtonTitle:@"Close" destructiveButtonTitle:@"Log Out" otherButtonTitles:@"View Account", nil]; [_actionSheet showInView:appDel.window]; 
+4
ios ios7 ios8 uiactionsheet
Sep 26 '14 at 14:27
source share
5 answers

UIActionSheet is deprecated in iOS 8.

enter image description here

To create and manage action sheets in iOS 8, you must use the UIAlertController with the preferred Style from the UIAlertControllerStyleActionSheet.

Refer to example .

+3
Sep 26 '14 at 14:45
source share
 UIAlertController * alert= [UIAlertController alertControllerWithTitle:@"Info" message:@"You are using UIAlertController" 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]; 
+1
Dec 09 '15 at 6:23
source share

This is clearly a regression in iOS 8. I filed rdar, please do it too.

In the meantime, you can fix this with a category or subclass where you check if the view is a window, and if so, grab the rootViewController view in that window and use it instead. That will work.

0
Dec 06 '14 at 2:07
source share

I was having problems with action files when iOS 8 came out. This is probably a problem with the view you present. Can you show it in real form, not in a window? At first, I experimented, and in the worst case, I complete the show method in something specific for iOS 7 and 8. I started using PSTAlertController to manage my alerts and action files. It supports UIAlertView, UIActionSheet and UIAlertController. It will sort which one to use, and also give you access to block actions for your buttons, while maintaining support for iOS 7 and 8. It’s worth a look.

0
Dec 06 '14 at 15:00
source share

If someone else sees this problem, the problem is actually caused by the fact that iOS 8 and 9 display your action plan behind the on-screen keyboard, so you cannot see it. You just see that the rest of the screen is getting darker. Genius

A simple solution is to add one line of code before displaying your UIActionSheet :

 [self.view endEditing:true]; 

This rejects the on-screen keyboard, making your beautiful action sheet visible again.

0
Feb 11 '16 at 9:10
source share



All Articles