Issue with UIActionSheet

23,748

Solution 1

Try this, it worked for me perfectly:

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

Solution 2

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

Solution 3

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.

Solution 4

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

Solution 5

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.

Share:
23,748
Joaquin McCoy
Author by

Joaquin McCoy

Updated on August 17, 2020

Comments

  • Joaquin McCoy
    Joaquin McCoy almost 4 years

    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?

  • filou
    filou over 11 years
    perfectly :)) just what I was looking for!!
  • katzenhut
    katzenhut about 11 years
    @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.
  • MANIAK_dobrii
    MANIAK_dobrii over 10 years
    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.
  • Erwan
    Erwan about 10 years
    very similar but less code and easier to remember, you could do: [actionSheet showInView:self.view.window]
  • LolaRun
    LolaRun almost 10 years
    or self.navigationController.view Thanks