从UIActionSheetpopup窗口中删除填充

我正在创build一个UIActionSheet,允许用户拍摄或select一张照片。 有人可以告诉我为什么它不显示相同的苹果? 这是iPad的,所以我没有宣布取消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的联系人应用程序。 利润率很高。 行之间的行。

在这里输入图像说明

我的工作应用示例。 在底部额外填充。 行之间没有行。

在这里输入图像说明

感谢您的任何见解。

尝试这个

 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]; 

你仍然需要声明一个取消button。 当在iPad上运行时,它将简单地忽略取消button,而在iPhone上它将使用它

我想保持使用addButtonWithTitle的灵活性,但不幸的是,在iPad上,它并没有在底部button上方显示一行。 这个伎俩。 如果有取消button,iPad会自动删除最后一个button。 如果您在iPad上,则不需要取消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.cancelButtonIndex = [actionSheet addButtonWithTitle:(@"Cancel"); [actionSheet showFromRect:self.imageView.frame inView:self animated:YES];