Search code examples
ioscocoa-touchuiactionsheet

UIActionSheet warning message in iOS


I am trying to show UIActionSheet from UINavigationController in iOS.

When i use [action showInView:self.view]; they showed me warning messages like following.

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

However UIActionSheet is showing correctly and nothing happened.

In my iOS , i support Landscape mode like following code.

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 3.0 ||
        UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
        [action showInView:self.view];
    } else {
        [action showInView:self.view.window];

I like to know that warning messages is important?

Or Can i ignore that warning messages?


Solution

  • Is your navigation controller showing a toolbar? If so, the bottom 44 points of the action sheet will likely not respond. To solve this, use [action showFromToolbar:self.navigationController.toolbar] (just like the error message says).

    The same applies if your navigation controller is in a tab bar, but then you should use [action showFromTabBar:self.tabBarController.tabBar].