我正在做一个动作表,以便弹出 3 个选项,拍照,选择照片或取消。该应用程序最初仅适用于 ipad,但现在我正在 iphone 上实现它。问题似乎出在界面上,因为它是在 ipad 上设置的。这是代码:
#pragma mark - UIActionSheetDelegate methods
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
CustomImagePickerController *imagePicker = [[CustomImagePickerController alloc] init];
[imagePicker setDelegate:self];
[imagePicker setAllowsEditing:YES];
if(buttonIndex == 0) {
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
} else if(buttonIndex == 1) {
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
CGSize winsize = [[CCDirector sharedDirector] winSize];
CGRect rect = CGRectMake(20,20,10,10);
rect.origin = [[CCDirector sharedDirector] convertToGL:rect.origin];
_popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[_popoverController setDelegate:self];
[_popoverController setPopoverContentSize:CGSizeMake(winsize.width, winsize.height) animated:NO];
[_popoverController presentPopoverFromRect:rect inView:[[CCDirector sharedDirector] view] permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}
这是错误:
2013-02-27 15:35:31.437 xxxxxxxx [8492:707] cocos2d: surface size: 480x320
2013-02-27 15:35:32.848 xxxxxxxx [8492:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.'
如何将此操作表设置为两个设备?
谢谢!