Search code examples
iosuiactionsheet

UIActionSheet doesn't appear


I am trying to create a UIActionSheet inside a UIViewController as follows:

discardAS = [[UIActionSheet alloc] initWithTitle:"title" delegate:self cancelButtonTitle:"Cancel" destructiveButtonTitle:"Discard" otherButtonTitles:nil];

discardAS.actionSheetStyle = UIActionSheetStyleDefault;
[discardAS showInView:[self view]];

When I evoke it - the entire screen "dim" (as if the actionsheet is actually in the foreground) - but I see no actionsheet.) It appears to be showing "offscreen".

WHen I try this on iOS7, I can see a white box shooting upwards, quickly going offscreen - as if it the ActionSheet is being placed above the top of the screen. When I click on the window, the dimness goes away, and all is normal - like iOS7 does if you tap out of the actionsheet and it goes away.

Thus, I am concluding the ActionSheet is being presented ABOUT (and out of) the confines of the screen.

I am also seeing the following on the console

 Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].

Both of which I tried, with the same results. Displaying self.view.frame shows a rect about 0,0,300,200 - so It's not grotesquely oversized.

Any idea why, or how to fix/debug?


Solution

  • For posterity - the answer was I had an "Extra View Controller" in my heirarchy - as described here: iOS 6: What changed that made this View Controller Hierarchy break?