Ios 从UIActionSheet Popover中删除填充
我正在创建一个UIActionSheet,允许用户拍摄或选择照片。有人能告诉我为什么它显示的和苹果的不一样吗?这是iPad的,所以我没有声明取消按钮Ios 从UIActionSheet Popover中删除填充,ios,ipad,ios7,Ios,Ipad,Ios7,我正在创建一个UIActionSheet,允许用户拍摄或选择照片。有人能告诉我为什么它显示的和苹果的不一样吗?这是iPad的,所以我没有声明取消按钮 UIActionSheet *actionSheet = [[UIActionSheet alloc] init]; actionSheet.delegate = self; [actionSheet addButtonWithTitle:NSLocalizedString(@"choosePhotoPopoverButton", @"Choose
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];
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];
苹果的联系人应用程序。利润微薄。行与行之间的行
我的工作应用程序示例。底部有额外的填充物。行与行之间没有行
感谢您的帮助。您仍然需要声明一个取消按钮。在iPad上运行时,它只会忽略“取消”按钮,而在iPhone上则会使用它
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];
我想保持使用addButtonWithTitle的灵活性,但不幸的是在iPad上,它没有在底部按钮上方显示一行。这就成功了。如果有取消按钮,iPad会自动删除最后一个按钮。如果你在iPad上,你不需要一个取消按钮
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];
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];
啊!这似乎可以解释这一点。谢谢