iPad iOS 6上带有cameraOverlayView的UIImagePickerController没有“拍照”按钮

时间:2012-09-16 05:03:22

标签: uiimagepickercontroller popover ios6 camera-overlay

以下代码创建一个带有UIImagePickerController的弹出框控制器,该控制器使用cameraOverlayView显示一个打开照片库的自定义按钮。

这适用于iOS 5,但在iOS 6上,"拍摄照片​​"按钮丢失了 - 相反 - 前后相机按钮之间有另一个切换!

请参阅以下屏幕截图 -

missing take photo button

这是代码 -     UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;

if ( ![UIImagePickerController isSourceTypeAvailable: sourceType] ) {
    [self openLibrary: sender];
    return;
}

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = sourceType;

UIButton *libraryButton = [UIButton buttonWithType: UIButtonTypeCustom];
libraryButton.frame = CGRectMake(12, 12, self.photoLibraryIcon.size.width, self.photoLibraryIcon.size.height);
[libraryButton setImage: self.photoLibraryIcon forState: UIControlStateNormal];
[libraryButton addTarget: self action: @selector(openLibrary:) forControlEvents: UIControlEventTouchUpInside];

[picker.cameraOverlayView addSubview:libraryButton];

__imagePickerPopoverController = [[UIPopoverController alloc] initWithContentViewController: picker];
self.imagePickerPopoverController.delegate = self;

[self.imagePickerPopoverController presentPopoverFromRect: CGRectMake(self.center.x - 5, self.center.y - 5, 10, 10)
                                                   inView: self.superview
                                 permittedArrowDirections: UIPopoverArrowDirectionAny
                                                 animated: YES];

如果我删除[picker.cameraOverlayView addSubview:libraryButton],它可以正常工作,但我的自定义按钮将会消失(正如预期的那样)。

那么为什么要分配cameraOverlayView更改底部工具栏?

有关如何获得"拍照的任何线索"按钮返回iOS 6?

0 个答案:

没有答案