【发布时间】:2012-01-15 09:30:51
【问题描述】:
我正在通过 UIPopOver 显示 UIImagePicker(它本身在 UIView 中)。这很好用,但是当 iPad 旋转到右侧时,我会在弹出框的左侧看到一个奇怪的黑条,如下图所示。取消按钮也部分位于屏幕右侧。这不会发生在任何其他奇怪的方向上。
代码也在下面列出。谁能建议我为什么会得到这个黑条?
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
CGFloat width = CGRectGetWidth(self.view.bounds);
CGFloat height = CGRectGetHeight(self.view.bounds);
UIViewController *containerController = [[UIViewController alloc] init];
containerController.contentSizeForViewInPopover = CGSizeMake(width, height);
[imagePickerController.view setFrame:containerController.view.frame];
[containerController.view addSubview:imagePickerController.view];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
Class cls = NSClassFromString(@"UIPopoverController");
if (cls != nil) {
popoverController = [[UIPopoverController alloc] initWithContentViewController:containerController];
[popoverController presentPopoverFromRect:selectedRect inView:self.view permittedArrowDirections:4 animated:YES];
[containerController release];
}
【问题讨论】:
标签: objective-c xcode ipad uiimagepickercontroller uipopovercontroller