1

私はPagesのような類似のメディアピッカーを再現しようとしています。 UIPopoverController内には、異なるメディアタイプを選択するUISegmentedControlがあります。私が持っているSegmentedControlの1つはLabeled Imagesです。私はそのセグメントを選択し、下のビューにImagePickerを表示させたいと思っています。UIImagePickerController - アルバムTableViewまたはアルバム選択をタップすると、テーブルが空白になりますか? iOS5

私は閉じる。私はいくつかの問題があります。 VCを提示すると、私が手: Popover with ImagePicker

私は、デバッガで以下の取得: それがどこから来ているUIStatusBarStyleBlackTranslucent is not available on this device.わかりません。私は一緒に試してみた:

 imagePicker.modalInPopover = YES; 
     imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext; 

私はまだそれを右に働かせることができないけれども。それはちょうど良いプレゼントです。私はUISegmentedControl私は私の他のメディアページを参照して、私は画像セグメントをクリックし、ImagePickerを参照してください、タイトルは '写真'ですキャンセルボタンがあります私は取り除く必要があり、私はデバイス上にある2つのアルバムを示しています。

TableViewの任意の場所をタップすると(アルバム内にあるかどうかにかかわらず)、2つのアルバムが消えます。 NavBarとキャンセルボタンはまだありませんが、アルバムはもうありません。アルバムをタップすると、アルバム内の画像は表示されませんが、行がハイライト表示されます。

Popover after tapping image Picker

私のコードの他の奇妙な部分は画像ピッカーのための委任がUIPopoverControllerを発表VCであるということです。それがその中にあるかどうかは分かりません。キャンセルボタンを押すと、私は次のようになります。

-[PLUILibraryViewController performSelector:withObject:withObject:]: message sent to deallocated instance 

ここでは、ピッカーを提示する私のコードです。

- (void) setupImagePicker { 

    IoScreenEditorViewController * ioScreenEditorViewController = (IoScreenEditorViewController *)[UIAppDelegate.ioMainViewController currentViewController]; 
    ioScreenEditorViewController.elementSelectedFromList = [elementsForPage objectAtIndex:0]; 
     // Show an image picker to allow the user to choose a new photo. 
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 
    imagePicker.delegate = ioScreenEditorViewController; 
    imagePicker.allowsEditing = NO; 
    NSArray * ourMediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil]; 
    [imagePicker setMediaTypes: ourMediaTypes]; 
    [ourMediaTypes release]; 

    if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { 
      // imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
     imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 

    } else { 
     imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
    } 

    [imagePicker.view setFrame:CGRectMake(0,0, 340, 500)]; // just for testing 

     //imagePicker.modalInPopover = YES; 
     //imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext; 
    [self.view addSubview:imagePicker.view]; 

    [imagePicker release]; 

} 

答えて

0

私はピッカーがUIViewControllerにから呼び出されていたことをクラスタイプを変更して、このように見えるようにプレゼンテーションコードを変更:

imagePicker.modalInPopover = YES; 
    imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext; 
    [self presentViewController:imagePicker animated:NO completion:^{ }]; 

私はまだキャンセルボタンを取得し、画像もののピッカーはうまくいくように働いているようです。

+0

キャンセルボタンは表示されませんでしたか?この記事をチェックしてください:https://devforums.apple.com/thread/186865 – Daniel

0

私はまだピッカーのキャンセルボタンを隠すことができませんでしたが、私はあなたがそれを提示している方法を修正することを提案します。

これについてiOS開発者のコ​​ミュニティから助力を得ようと努力して、サンプルプロジェクトを作成して、ダウンロードしてください。プロジェクトでは、画面上にピッカーを表示するためにView Controllerの格納を使用していることがわかります。

これはおそらくこれを行うには良い方法でしょうか?

https://bitbucket.org/danielphillips/image-picker-demo

関連する問題