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.

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

Thanks for any insight.
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];
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With