tags:

views:

41

answers:

1

I have an app with tabs and navigation controllers.

Everything works great except a UIActionSheet. I even have a UIAlertView taht shows fine in the same controller, but the action sheet doesn't show. The screen goes dark, like it's showing, but no view.

Here's the relevant code:

UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Erase the file?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Clear List"
otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

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

//[actionSheet showInView:self.view];

//MyAppDelegate* delegate = [[UIApplication sharedApplication] delegate];
//[actionSheet showInView:delegate.tabBarController.view];

[actionSheet release];

The commented out code was the different ways of showing it that I've tried.

Any thoughts as to why this isn't working?

A: 

Don't show it from the current keyWindow - show it from the actual tab bar with something like

[actionSheet showFromTabBar:delegate.tabBarController.tabBar];
Adam Wright
Thanks, that worked. I'll read into more as why this is. I'll check the answer correct in 8 minutes when the site lets me.
just_another_coder