4
votes

In my tabbar app, i bring up a UIActionsheet from an action, called from a button in a navigation controller title bar.

The UIActionsheet functions as per normal, except for the bottom half of the below button 'cancel', which strangely doesnt respond to touch in the iPhone Simulator. The bottom half of the cancel button is where the UITabBar lies behind, and therefore is probably the problem.

Any ideas?

alt text http://img12.imageshack.us/img12/2166/screenshot20100119at236.png

Solution

My solution was from the first answer. Here is my working example code

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:message delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"OK" otherButtonTitles:nil];
        actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
        [actionSheet showInView:[UIApplication sharedApplication].keyWindow];
        [actionSheet release];
1
Looks like this works regardless of if you are using a TOOLBAR or a non-TOOLBAR view. Should we just 'always' use this method?Patricia

1 Answers

19
votes

This looks like an UIActionSheet to me...

Anyway, you should show the action sheet as a subview of the application window, not of the current view.

UIActionSheet *actionSheet = [[UIActionSheet alloc] init...];

// ...

[actionSheet showInView:[UIApplication sharedApplication].keyWindow];