36

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?

Joaquin McCoy
  • 525
  • 1
  • 5
  • 11

10 Answers10

61

Try this, it worked for me perfectly:

[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
Flexo
  • 82,006
  • 22
  • 174
  • 256
VSN
  • 2,311
  • 19
  • 29
  • perfectly :)) just what I was looking for!! – filou Mar 01 '13 at 14:29
  • @VSN theres a problem with this if youopen the actionsheet in landscape mode. the actionsheet will enter the screen from the side and it will be rotated by 90 degrees. do you have any solution for that? because otherwise its really helpful. tia. – katzenhut Jun 06 '13 at 09:33
  • very similar but less code and easier to remember, you could do: [actionSheet showInView:self.view.window] – Erwan Jun 20 '14 at 06:07
28

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];

tilo
  • 13,266
  • 6
  • 62
  • 81
Fred
  • 3,993
  • 27
  • 41
12

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.

conecon
  • 404
  • 4
  • 10
5
    [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.

LeverkusenFan
  • 293
  • 4
  • 8
  • Thanks, this one was the only to work it out for me (with slight additions to work both with and without navigation controller). A had similar problem with a custom iOS6 + iOS7 window configuration, when for iOS7 you shift your window down 20 points and leave everything as it is. – MANIAK_dobrii Dec 04 '13 at 07:20
1

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.

Raptor
  • 48,613
  • 43
  • 209
  • 344
0

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

wrightak
  • 646
  • 4
  • 7
0

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

[actionSheet showInView:self.view.superview];
Bruno Belotti
  • 2,036
  • 1
  • 28
  • 27
0

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...

Erwan
  • 3,608
  • 26
  • 25
0

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.

Casey Perkins
  • 1,586
  • 2
  • 20
  • 38
0

Heres the Swift version:

actionSheet.showInView(UIApplication.sharedApplication().keyWindow)
Esqarrouth
  • 35,175
  • 17
  • 147
  • 154