gpt4 book ai didi

objective-c - 如何在 iPad 上更改 UIImagePickerController 的大小宽度?

转载 作者:可可西里 更新时间:2023-11-01 06:19:16 25 4
gpt4 key购买 nike

如何在 iPad 上改变 UIImagePickerController 的大小宽度?我可以改变高度,所以它是 700,但不能改变宽度,它仍然是 320。我的代码。

 UIImagePickerController*  imagePicker=[[UIImagePickerController alloc]init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate=self;
CGRect myRect = CGRectMake(imagePicker.view.frame.origin.x, imagePicker.view.frame.origin.y, 720, 700);
imagePicker.view.frame = myRect;
self.popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
myRect = CGRectMake(100, 880, 900, 900);
CGRect re2 = CGRectMake(0,0,800,800);
[self.popover setPopoverContentSize:re2.size];
[self.popover presentPopoverFromRect:[self.view bounds] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[self.popover presentPopoverFromRect:myRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[self.popover setPopoverContentSize:re2.size];

最佳答案

我遇到了同样的问题,我用 UINavigationControllerDelegate 解决了,因为 PhotoLibrary 的 UIImagePickerView 内容是一个 navigatorController。当您选择一行时,它会更改 ViewController 并且弹出窗口的大小也会更改。因此,在您的 willShowViewController 委托(delegate)中只需放置:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
viewController.contentSizeForViewInPopover = CGSizeMake(800, 800);
}

这将阻止调整弹出窗口的大小。

关于objective-c - 如何在 iPad 上更改 UIImagePickerController 的大小宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13766558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com