views:

130

answers:

1

I have an Action Sheet that is called from my root view controller using the code below. That view has a Toolbar on the bottom of the view measuring 44 pixels high. The problem is when the Action Sheet opens it's not at the bottom of the view, the bottom of the Action View is about 20 or so pixels above the bottom of the view so some of the Toolbar is visible below the Action Sheet. Using the same code on other views I have no such problem. How do I remedy this? Any help is appreciated! lq

UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:self 
cancelButtonTitle:@"Do Something" 
destructiveButtonTitle:@"Do Something Destructive" 
otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view];
[actionSheet release];
+1  A: 

If you have a toolbar, use the -showFromToolbar: method instead of -showInView:.

KennyTM
Trying the showFromToolbar method I get the following error: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil'I created an Outlet for the UIToolbar, connected it in the XIB. Can't figure out what I'm doing wrong. I replaced:[actionSheet showInView:self.view];with[actionSheet showFromToolbar:myToolBarName];
Lauren Quantrell
I can't find a code example to make showFromToolbar work for me. The code calling the Action Sheet is being called from the AppDidLoad method (if x condition exists on startup, show action sheet) and my main view is not yet loaded so throws and error.
Lauren Quantrell
@Lauren: Try to call it from the view controller's `-viewDidAppear` method instead.
KennyTM