私はPagesのような類似のメディアピッカーを再現しようとしています。 UIPopoverController
内には、異なるメディアタイプを選択するUISegmentedControl
があります。私が持っているSegmentedControlの1つはLabeled Imagesです。私はそのセグメントを選択し、下のビューにImagePickerを表示させたいと思っています。UIImagePickerController - アルバムTableViewまたはアルバム選択をタップすると、テーブルが空白になりますか? iOS5
私は閉じる。私はいくつかの問題があります。 VCを提示すると、私が手:
私は、デバッガで以下の取得: それがどこから来ているUIStatusBarStyleBlackTranslucent is not available on this device.
わかりません。私は一緒に試してみた:
imagePicker.modalInPopover = YES;
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
私はまだそれを右に働かせることができないけれども。それはちょうど良いプレゼントです。私はUISegmentedControl
私は私の他のメディアページを参照して、私は画像セグメントをクリックし、ImagePickerを参照してください、タイトルは '写真'ですキャンセルボタンがあります私は取り除く必要があり、私はデバイス上にある2つのアルバムを示しています。
TableViewの任意の場所をタップすると(アルバム内にあるかどうかにかかわらず)、2つのアルバムが消えます。 NavBarとキャンセルボタンはまだありませんが、アルバムはもうありません。アルバムをタップすると、アルバム内の画像は表示されませんが、行がハイライト表示されます。
私のコードの他の奇妙な部分は画像ピッカーのための委任が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];
}
キャンセルボタンは表示されませんでしたか?この記事をチェックしてください:https://devforums.apple.com/thread/186865 – Daniel