我正在嘗試更改UIImagePicker的大小,該UIImagePicker是通過UIPopOver呈現的。代碼如下所示。問題在於PopOver尺寸無法正確顯示 - 它會以正確的尺寸短暫閃爍,然後縮小爲通常的默認尺寸。通過UIPopOver(iPad)提供的UIImagePicker更改大小
有人可以告訴我如何改變popover的大小嗎?
- (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