Search code examples
iphoneiphone-sdk-3.0iosuipickerviewuiactionsheet

UIPickerView inside an action sheet is not responsive from bottom half


I created a UIPickerView inside an UIActionSheet, using the following tutorial: Add UIPickerView & a Button in Action sheet - How?

I've noticed that the UIPickerView does not respond to touches below the bottom half of the UIPicker. Perhaps just below the selection bar, but not any more below.

Has anyone had any similar experiences and resolved them?


Solution

  • I had a similar problem recently where I was presenting 3 options and a cancel. The lower 3 buttons seemed about half a button out of alignment. I had to click inbetween the buttons to get them to operate. It all depended on where I was presenting the action sheet from. If you have a TabBarController you should present the action sheet from there:

    [actionSheet showInView:self.parentViewController.tabBarController.view];
    

    If you just have the view itself, with perhaps a navbar then presenting it from the view is fine:

    [actionSheet showInView:self.view];
    

    In my case I had a tab bar for the iphone and not for the ipad version so I did this:

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        [actionSheet showInView:self.view];
    } else {
        [actionSheet showInView:self.parentViewController.tabBarController.view];
    }
    

    It's not clear from the UIActionSheet reference documentation but it might be wise to present the action sheet from the 'front' most controller that is sensible. So if there is a toolbar at the bottom present it from that. These restrictions do not appear to apply to the iPad as action sheets are presented inside popovers.

    Hope that helps.