0

I have upgraded my project but its strange that UIActionSheet not showing in window.

  UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
[actionImageProcess showInView:window]; 

What's the another solution for that..

Sunny Shah
  • 12,990
  • 9
  • 50
  • 86
  • But you are not showing the action sheet from the window. You are showing it from `self.view` (a view controller?). – rmaddy Sep 20 '14 at 06:05
  • Sorry I just changed the code.. – Sunny Shah Sep 20 '14 at 06:08
  • I had the same problem (and a few others) with `UIActionSheet` under iOS 8. I ended up switching to `UIAlertController` and showing the action sheet from anything other than the window. – rmaddy Sep 20 '14 at 06:17
  • Your code worked for me when I invoked it in a button method (in Xcode 6.0.1). Where do you have this code? Are you sure actionImageProcess is not nil? – rdelmar Sep 20 '14 at 06:21
  • @rdelmar Can you check one more thing in my app - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex method call two times – Sunny Shah Sep 20 '14 at 06:49
  • are you facing the same problem – Sunny Shah Sep 20 '14 at 06:50
  • No, I am not having that problem; the delegate method is called only once. – rdelmar Sep 20 '14 at 16:00
  • It's a regression. Please see http://stackoverflow.com/questions/26061964/uiactionsheet-not-showing-in-ios-8?stw=2 – DrMickeyLauer Dec 06 '14 at 14:21

1 Answers1

2

It doesn't work because Apple changed internal implementation of UIActionSheet. Please refer to the documentation

Important: UIActionSheet is deprecated in iOS 8. (Note that UIActionSheetDelegate is also deprecated.) To create and manage action sheets in iOS 8 and later, instead use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet.

Subclassing Notes

UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with presentViewController:animated:completion:.