私はUIPopOverを使ってプレゼンテーションしているUIImagePickerのサイズを変更しようとしています。コードを以下に示します。 PopOverのサイズが正しく表示されないという問題があります。ポップオーバーのサイズが短時間、正しいサイズで点滅してから、通常のデフォルトサイズにアニメートされます。UIPopOver(iPad)で表示されるUIImagePickerのサイズを変更する
私はどのように私がポップオーバーのサイズを変更することができますか?私はこれが最もエレガントな解決策であるかわからない
- (void)showImagePickerForPhotoLibrary {
NSLog(@"Picker");
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.contentSizeForViewInPopover = CGSizeMake(768, 1000);
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
Class cls = NSClassFromString(@"UIPopoverController");
if (cls != nil) {
popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
//popoverController.popoverContentSize = CGSizeMake(768, 1000);
[popoverController presentPopoverFromRect:selectedRect inView:self.view permittedArrowDirections:4 animated:YES];
}
}
else {
[app.mainViewController presentModalViewController:imagePickerController animated:YES];
}
}
ありがとうございました。とにかくiPadの幅と高さをcontainerController.contentSizeForViewInPopover = CGSizeMake(768,1000)という行で取得できますか? ? – GuybrushThreepwood
ipadの解像度は768x1024です。 CGSizeMake(self.view.frame.size.width、self.view.frame.size.height)を試してみてください – Mutix
この種の作品ですが、別の(奇妙な)バグが発生します:http ://stackoverflow.com/questions/8422636/black-bar-in-uiimagepicker-on-ipad-only-in-landscape-right-orientation – GuybrushThreepwood