【发布时间】:2012-01-07 14:58:54
【问题描述】:
我正在制作一个通用应用程序,它在 iPhone 上运行良好!但在 iPad 上,它无法拉起图像选择器。代码是:
- (IBAction)openImagePicker:(id)sender //Makes UIImagePicker roll up from the bottom.
{
UIActionSheet *alertSheet = [[UIActionSheet alloc] initWithTitle:@"Where do you want to get your daily image?" delegate:(self) cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Library", nil];
[alertSheet setTag:0];
[alertSheet setDelegate:self];
[alertSheet showFromTabBar:[[self tabBarController] tabBar]];
[alertSheet release];
}
它说原因是“* 由于未捕获的异常‘NSInvalidArgumentException’而终止应用程序,原因:‘在 iPad 上,UIImagePickerController 必须通过 UIPopoverController 呈现’”我该怎么做?感谢您的帮助。
【问题讨论】:
-
您需要检查 iPad 的代码并显示一个弹出框,否则只显示图像控制器。
标签: objective-c ios cocoa-touch ipad uipopovercontroller