UIActionsheet displaying in iPhone but not in iPad

484 views Asked by At

I have one actionSheet and after clicking on button of this another actionSheet is displayed. This is working fine in iPhone but in iPad second actionSheet does not appear after clicking on button of 1st actionSheet.

2

There are 2 answers

0
Waseem Shah On

First of all, UIActionSheet existed before UIPopoverController and UIPopoverController isn't available on iPhone, so it's useful for backwards compatibility and universal apps.

Also, a UIActionSheet isn't necessarily presented in a popover, specifically, if you show it from a UIBarButtonItem or UIToolbar that is already inside a popover. It is then presented in a similar fashion as on the iPhone (sliding in from the bottom of the view controller). According to the HIG, you must not present multiple popovers at the same time (I once had an app rejected for that), so in cases where a view controller may be inside a popover (like in a standard split view app), you may want to use action sheets, if possible. Of course there are a lot of cases where you can't replace a popover with an action sheet, because an action sheet only shows a list of buttons and a title, whereas a popover can display any view controller.

I think that the animated parameter only has an effect when an action sheet is presented in the "classic" (as on iPhone) way.

0
Siddharth Kothari On

.I think the issue is you are trying to present second action sheet before first one is dismissed. In method

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex

Check if the action sheet dismissed is first one and then present second one via

- (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated 

You can use tag property to differentiate between the two action sheets.