Search code examples
iosios7ios8uiactionsheet

UIActionSheet not showing in iOS 8


I can show the actionSheet in iOS 7 but cannot show in iOS 8 environment. Is there any way to trace?

  UIActionSheet *_actionSheet = [[UIActionSheet alloc] initWithTitle:@"Account"
                                                               delegate:self 
                                                      cancelButtonTitle:@"Close" 
                                                 destructiveButtonTitle:@"Log Out" 
                                                      otherButtonTitles:@"View Account", nil];

    [_actionSheet showInView:appDel.window];

Solution

  • UIActionSheet is deprecated in iOS 8.

    enter image description here

    To create and manage action sheets in iOS 8 you should use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet.

    Refer this example.