1

iPad アプリケーションからフォト ライブラリにアクセスしようとしています。「iPad では、UIImagePickerController を UIPopoverController 経由で提示する必要がある」とのことです。それはまさに私も受け取るログメッセージです。

ここに私のアプリのスナップショットがあります:

https://www.evernote.com/shard/s241/sh/b0283978-b50b-425f-8e8f-b9a5a171c463/de48b8b2dfe7716fe304e85a18ecacfc

すでにポップオーバーを介してオプションをリストしているため、その中から別のポップオーバーに移動しても意味がありません。ユーザーが「フォト ライブラリ」セルをタップすると、accessPhotoLibrary メソッドが呼び出されます。

-(void)accessPhotoLibrary{
    NSLog(@"Photo library access requested!");
    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
        NSLog(@"Photo Library");
        [imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
        [imagePickerController setDelegate:self];
        [imagePickerController setModalPresentationStyle:UIModalPresentationFullScreen];
        [self presentViewController:imagePickerController animated:YES completion:nil];
    }
    else{
        UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle: @"Photo Library"
                              message: @"Sorry, couldn't open your photos library"
                              delegate: nil
                              cancelButtonTitle:@"OK"
                              otherButtonTitles:nil];
        [alert show];
    }
}

しかし、すでにポップオーバーを使用しているときに、ポップオーバーを使用して写真ライブラリにアクセスする必要があるというこの問題を回避するにはどうすればよいですか??

どんな助けでも大歓迎です。

4

1 に答える 1

0

同じポップオーバー内に画像ピッカーを表示できます。ポップオーバーへの参照を保持すると (ポップオーバーを提示する親ビュー コントローラーは参照を渡すことができます)、次のことができます。

[_parentPopover setContentViewController:imagePickerController animated:YES];

必要に応じて、イメージ ピッカー ビュー コントローラーの "contentSizeForViewInPopover" プロパティを使用して、ポップオーバーに表示されるコンテンツのサイズを変更できます。

于 2013-04-18T17:06:39.910 に答える