自 iOS7 升级以来,我对UIImagePickerController
. 在这个应用程序中,我使用UIImagePickerController
带有cameraOverlayView
.
在 iOS6 中,我调用UIImagePickerController
了以下代码:
_picker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]) {
_picker.sourceType = UIImagePickerControllerSourceTypeCamera;
_picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
_picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
_picker.showsCameraControls = NO;
_picker.navigationBarHidden = NO;
_picker.toolbarHidden = YES;
_picker.wantsFullScreenLayout = YES;
_overlayViewController = [[OverlayViewController alloc] init];
_overlayViewController.picker = _picker;
_overlayViewController.frameSize = self.frameSize;
_overlayViewController.delegate = self;
_picker.cameraOverlayView = _overlayViewController.view;
}
else {
_picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
_picker.delegate = self;
其中OverlayViewController
是UIViewController
,具有透明背景,可在屏幕上绘制一些自定义控件。
但现在在 iOS 7 中,摄像头是通过状态栏绘制的,并且在实时摄像头视图下方会出现一个黑条。
我可以通过将 aCGAffineTransformMakeTranslation
应用于 的cameraViewTransform
属性来解决这个问题UIImagePickerController
,但为什么会这样呢?