操作表到其他接口/设备

时间:2013-02-27 18:48:11

标签: ios ipad cocos2d-iphone

我正在制作一张活动表,以便弹出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.'

如何将此操作表设置为两个设备?

谢谢!

1 个答案:

答案 0 :(得分:1)

你不能在iPhone或iPod Touch上使用UIPopoverViewController,这是一个只能在iPad上实例化的类。