3
我的弹窗大小在iOS 7中大小不正确。高度工作正常,但宽度没有设置。无论我设置的是什么,popover的宽度都很小。它仍然可以在iOS 6中运行,但在iOS 7中可以运行。7中有没有新的东西需要处理,我失踪了?UIPopoverController宽度未设置
下面是iOS中工作6,而不是适用于iOS 7的代码:
self.mediaPicker = [[UIImagePickerController alloc] init];
self.mediaPicker.contentSizeForViewInPopover = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
self.cameraPickerPopover = [[UIPopoverController alloc] initWithContentViewController:self.mediaPicker];
self.cameraPickerPopover.popoverContentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
self.cameraPickerPopover.delegate = self;
[self.cameraPickerPopover presentPopoverFromRect:self.toolbar.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:animated];
我发现contentSizeForeViewInPopover在iOS的7弃用,所以我更新的代码如下所示,仍然没有工作:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
self.mediaPicker.contentSizeForViewInPopover = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
} else {
self.mediaPicker.preferredContentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
}