I have this problem: here is my code:
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Share the race" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Send with mail" otherButtonTitles:nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[popupQuery showInView:self.view];
[popupQuery release];
and everything seems ok, the 2 buttons are showed right, the "send with mail" button is ok, but the cancel catch the click only on the upper side... here a shot that illustrate the situation:
how can I solve this?
thanks:)
My guess is that the bottom portion of the UIActionSheet
extends beyond the bounds of the view, and so doesn't respond to touches.
To test this theory, add another button and see if all upper buttons work fine but the bottom button still exhibits this behavior.
To fix this problem, make sure the view extends to the bottom of the screen. If you have a tabBar in your app, that's going to be my suspect for the problem. You could use showFromTabBar:
if you want the sheet above the tabBar, or showFromToolbar:
to show it from a toolBar.
If you don't have a bottom bar, then I'm wrong and have no idea.
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];
May be it will help others.
Happy Coding :)
use
[actionSheet showFromTabBar:[[self tabBarController] tabBar]];
instead of
[actionSheet showInView:self.view];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With