Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Padding from UIActionSheet Popover

Tags:

ios

ios7

ipad

I am creating a UIActionSheet to allow users to Take or Select a photo. Can someone tell me why it does not display the same as Apple's? This is for the iPad, so I have not declared a Cancel button.

UIActionSheet *actionSheet = [[UIActionSheet alloc] init];
actionSheet.delegate = self;
[actionSheet addButtonWithTitle:NSLocalizedString(@"choosePhotoPopoverButton", @"Choose Photo - Get a photo from the album.")];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
    [actionSheet addButtonWithTitle:NSLocalizedString(@"takePhotoPopoverButton", @"Take Photo - Use camera to take photo.")];
}
[actionSheet showFromRect:self.imageView.frame inView:self animated:YES];

Apple's Contacts app. Tight margins. Line between rows.

enter image description here

My working app example. Extra padding at bottom. No line between rows.

enter image description here

Thanks for any insight.

like image 354
DenVog Avatar asked Jun 24 '26 20:06

DenVog


2 Answers

Try this

UIActionSheet *actionSheet;

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
    actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate: self cancelButtonTitle:@"" destructiveButtonTitle:nil otherButtonTitles:@"Take Photo",@"Camera", nil];
}else{
    actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate: self cancelButtonTitle:@"" destructiveButtonTitle:nil otherButtonTitles:@"Take Photo", nil];
}

[actionSheet showFromRect:self.imageView.frame inView:self animated:YES];
like image 167
Bilal Saifudeen Avatar answered Jun 27 '26 09:06

Bilal Saifudeen


You still need to declare a cancel button. When running on the iPad it will simply ignore the cancel button, whereas on iPhone it will use it

like image 25
Paul.s Avatar answered Jun 27 '26 10:06

Paul.s



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!