重複の可能性:
iPhone 4.0 の UIPopover
Xcode にユニバーサル アプリがあります。ユーザーが iPad を使用している場合、[ライブラリの画像を使用] ボタンはうまく機能します。ただし、iPhone を使用している場合、ボタンは機能しません。
これが私が受け取るエラーです。
キャッチされていない例外 'NSInvalidArgumentException' が原因でアプリを終了しています。
助けてください!
これが私のコードです。
- (IBAction) useCameraRoll: (id)sender
{
if ([self.popoverController isPopoverVisible]) {
[self.popoverController dismissPopoverAnimated:YES];
} else {
if ([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeSavedPhotosAlbum])
{
UIImagePickerController *imagePicker =
[[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType =
UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [NSArray arrayWithObjects:
(NSString *) kUTTypeImage,
nil];
imagePicker.allowsEditing = YES;
newMedia = NO;
}
}
}
次のコードを組み込むにはどうすればよいですか? if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { ポップオーバー コードをここに
追加 } else { ポップオーバーの代替をここに追加 }