Re: UIActionSheet -addButtonWithTitle weirdness on iPad
Re: UIActionSheet -addButtonWithTitle weirdness on iPad
- Subject: Re: UIActionSheet -addButtonWithTitle weirdness on iPad
- From: Fritz Anderson <email@hidden>
- Date: Wed, 02 Oct 2013 14:21:45 -0500
The class reference _recommends_ not providing a Cancel button for an action sheet that presents in a popover — the user can easily cancel by tapping elsewhere. ("there are times when you should not include a cancel button") <xcdoc://ios/documentation/UIKit/Reference/UIActionSheet_Class/Reference/Reference.html> The HIG is indirect, recommending a Cancel button for the iPhone, but silent on whether it means _only_ on the iPhone.
But if the action sheet is to cascade from another popover, the class reference says you must provide one. The HIG is silent. Also, the HIG implies that a Cancel button should be added like any other button, which puzzles me about how to handle the special decoration a Cancel button requires.
A Google search on stackoverflow.com tells me that if a Cancel button is specified on iPad, it will bump the last button from the sheet. So much for "should not." I haven't made the experiment of cascading the sheet on a popover.
When I'm off work, I'll try the experiment and file a documentation bug.
— F
On 2 Oct 2013, at 11:33 AM, Markus Spoettl <email@hidden> wrote:
> Hello,
>
> I just came across the following, would someone confirm this:
>
> UIActionSheet *sheet =
> [[UIActionSheet alloc] initWithTitle:nil
> delegate:self
> cancelButtonTitle:@"Cancel"
> destructiveButtonTitle:nil
> otherButtonTitles:nil];
>
> [sheet addButtonWithTitle:@"Button1"];
> [sheet addButtonWithTitle:@"Button2"];
>
> [sheet showFromRect:someRect inView:someView animated:YES];
>
> On the iPad (both device and simulator) this produces a sheet with "Button2" missing. No matter how many buttons one adds, the last one added goes missing.
>
> On iPhone (again both device and simulator) this produces a sheet with the expected buttons "Cancel", "Button1", "Button2".
>
> If I set the cancelButtonTitle: parameter to nil, both iPad and iPhone behave correctly, iow "Button1", "Button2".
>
> This is on iOS 7.0, Xcode 5.0 (5A1413).
>
> Regards
> Markus
> --
> __________________________________________
> Markus Spoettl
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden