Note that there are some explanatory texts on larger screens.

plurals
  1. POUIActionSheet does not show -- the screen just gets darker
    text
    copied!<p>I have an iPhone application which is based on the "Window based application" template and which uses a main view with some embedded subviews.</p> <p>For some action I need a confirmation by the user. Therefore, I create an UIActionSheet and ask the user for feedback.</p> <p>The problem is, that the action sheet does not show at all. Instead, the screen gets darker. The sheet and the requested buttons do not show. After that, the application hangs. The darkening of the screen is a normal behavior as part of the animation which normally shows the action sheet.</p> <p>Curiously, the same code works fine, if invoked in the viewDidLoad method. It does not work if invoked in the buttonPressed method which starts the action requiring the confirmation.</p> <pre><code>- (void) trashButtonPressed { // This method is called in the button handler and (for testing // purposes) in the viewDidLoad method. NSLog( @"trashButtonPressed" ); UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle: @"Test" delegate: self cancelButtonTitle: @"Cancel" destructiveButtonTitle: @"Delete Sheet" otherButtonTitles: nil]; [actionSheet showInView: self.view]; [actionSheet release]; } - (void) willPresentActionSheet:(UIActionSheet *) actionSheet { NSLog( @"willPresentActionSheet" ); } - (void) didPresentActionSheet:(UIActionSheet *) actionSheet { NSLog( @"didPresentActionSheet" ); } - (void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { NSLog( @"actionSheet:didDismissWithButtonIndex" ); } </code></pre> <p>As you can see, I have added some logging messages to the protocol handlers of the UIActionSheetDelegateProtocol. The "will present" and "did present" methods get called as expected, but the sheet does not show.</p> <p>Does anybody know, what's wrong here?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload