在我的 iPad 应用程序中,我正在录制视频(UIImagePickerController
在 a 中UIPopoverController
)。
问题是当我改变设备的方向时,尺寸会UIPopoverController
减小到 320x480(纵向)和 480x320(横向)。令人惊讶的是,完全相同的尺寸(600x880)在我创建它时工作正常,但在我旋转它时却不行。
这是我的初始化方式:
self.popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
popover.delegate = self;
if ([[UIApplication sharedApplication] statusBarOrientation] == UIDeviceOrientationPortrait || [[UIApplication sharedApplication] statusBarOrientation] == UIDeviceOrientationPortraitUpsideDown) {
[self.popover presentPopoverFromRect:CGRectMake(109, 590, 550,500) inView:self.view permittedArrowDirections:0 animated:YES];//recordProtocolBtn.frame
[self.popover setPopoverContentSize:CGSizeMake(600, 880)];
}
else {
[self.popover presentPopoverFromRect:CGRectMake(750, 110, 550, 600) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
[self.popover setPopoverContentSize:CGSizeMake(600, 600)];
}
旋转到纵向:
[self.popover dismissPopoverAnimated:NO];
[self.popover presentPopoverFromRect:CGRectMake(109, 590, 550,500) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
[self.popover setPopoverContentSize:CGSizeMake(600, 880)];
并旋转到景观:
[self.popover dismissPopoverAnimated:NO];
[self.popover presentPopoverFromRect:CGRectMake(750, 110, 550, 600) inView:self.view permittedArrowDirections:0 animated:YES];
[self.popover setPopoverContentSize:CGSizeMake(600, 600)];