Reputation: 35953
I need to present a UIActionSheet that will show 10 buttons. When I do that on iPad, the UIActionSheet shows on a popover that is very long vertically (not aesthetically pretty). Is that possible to specify the UIActionSheet size to a maximum size?
I have tried this
myActionSheet.frame = CGRectMake(0,0,300,300);
myActionSheet.bounds = CGRectMake(0,0,300,300);
and have also tried to put these lines inside
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
without success.
any clues?
thanks
Upvotes: 1
Views: 6966
Reputation: 10080
I think this is one of the cases where you can't really use a built-in class like the UIActionSheet
to accomplish your goal. I don't think it is designed to be used for cases where you have as many buttons as 10. It just doesn't scale very well, just as you have discovered.
But let's pretend that it would be possible to change the size. What should happen when you change the size? There is a minimum size for each button for it to be tapable. And you also need some space between the buttons as to not cause a misstap. So even if you could change the size it couldn't be reduced by very much. And since it's not intended to be able to change the size you would have to try and access all the buttons and resize and move them as well. One could argue that perhaps the buttons could be placed in columns but since that is not implemented it would still not help if you made the UIActionSheet
any wider.
I would recommend that you either:
If you set modalInPopover
to YES
on the UIViewController
you present in the popover the user must make a choice before she can move on.
Upvotes: 2
Reputation: 999
try with `- (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated because in apple documentation they said: "On iPad, this method displays the action sheet in a popover whose arrow points to the specified rectangle of the view. The popover does not overlap the specified rectangle."
`
Upvotes: 0