36
votes

When I run my app and I click button for actionsheet appears this:

Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].

How can I fix?

10

10 Answers

61
votes

Try this, it worked for me perfectly:

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

You could try [MyActionSheet showInView:super.view]; or if you have a UITabBar or UIToolbar then, as it suggests, you can use [MyActionSheet showFromTabBar:self.tabBarController.tabBar]; or [MyActionSheet showFromToolBar:self.toolbar];

12
votes

It should be resolved to use [actionSheet showInView:self.parentViewController.view]; instead of self.view if you are using UINavigationViewController because this controller has top navigation bar as default.

5
votes
    [sheet showInView:[UIApplication sharedApplication].keyWindow];
    sheet.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height-sheet.frame.size.height, [UIScreen mainScreen].bounds.size.width, sheet.frame.size.height);

This should solve the problem.

1
votes

I resolved my nearly-the-same case by:

YourAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[actionSheet showFromTabBar:delegate.tabBarController.tabBar];

assume you use TabBarController xCode template as a start.

0
votes

Remember that your toolbar may be part of your navigation controller. You can access it with self.navigationController.toolbar

0
votes

Another similar solution, which worked for me with a UIPageViewController -> UINavigationViewController -> TableViewController structure, is:

[actionSheet showInView:self.view.superview];
0
votes

Use this:

[actionSheet showInView:self.view.window];

This will force the action sheet to be displayed above navigation bars and respond to all taps. Note however that if you use some left/right sliding menu libraries, this may result in the actionSheet to be presented off screen. Just test...

0
votes

I tried all of the above answers to no avail. Ultimately, I found that the only solution was to reduce the number of items on the action sheet, which was overflowing.

0
votes

Heres the Swift version:

actionSheet.showInView(UIApplication.sharedApplication().keyWindow)