UIActionSheet's cancel button presses not detected properly

Number:rdar://6410780 Date Originated:12/1/2008
Status:closed Resolved:duplicate/6396105
Product:iPhone Product Version:2.2
Classification:Serious Bug Reproducible:Always
01-Dec-2008 07:10 PM Tom Saxton:
I'm seeing the same problem reported in rdar://6396105

It's a killer bug that the user will see as disabling the Cancel button in a UIActionSheet, force the user to either kill the app with the home button, or choose one of the destructive action buttons.

This will keep me from deploying my iPhone App, Grocophile, on iPhone OS 2.2.

01-Dec-2008 10:22 PM Tom Saxton:
I looked at this bug some more, and it seems to be an issue with the tabbar.

If you call UIActionSheet's [sheet showInView:self.view] from a view controller that is a child of a UITabViewController, then the hit testing on the cancel button fails in that portion of the UIActionSheet that lies above the tabbar's view.

If you instead pass in the UITabBarController's view, then the UIActionSheet acts as expected.

NOTE: in iPhone OS 2.1 and earlier, the UIActionSheet came up from the top of the tab bar when you pass the child view, but in 2.2, it comes up from the bottom of the tab bar, and thus covers the tab view.


1. Build the attached project for iPhone OS 2.1, and run on the simulator.
2. Press the "Clear" button.

RESULT: The cancel button in the resulting UIActionSheet works as expected.

NOTE: The bottom the action sheet is coincident with the top of the tab bar.

3. Build the same app for iPhone OS 2.2, and run on the simulator.

RESULT: If you press the cancel button below the top of the tab bar (barely visible through the semi-transparent UIActionSheet), the click does not register. If you click above the underlying tab bar, the click does work.

EXPECT: clicking anywhere within the cancel button should work.

NOTE: The bottom the action sheet is coincident with the bottom of the tab bar.

4. In the same app, open "FirstViewController.m" and remove the comment // from in front of the #define IPHONE_OS_2_2_WORKAROUND to enable workaround code in the method "askClearList:".

5. Build the app for iPhone OS 2.2 and run the app in the simulator.

RESULT: The Cancel button works as expected.

NOTE: The bottom the action sheet is coincident with the bottom of the tab bar.

Sample code added to Apple bug report, also available at http://homepage.mac.com/tomsax/TabBarActionSheet.zip


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!