UIImagePickerController的cameraOverlayView未在iOS 8中显示

时间:2014-09-16 07:24:30

标签: objective-c iphone uiimagepickercontroller ios8

我正在提交UIImagePickerController,如下所示,

if (!self.imagePickerController) self.imagePickerController = [[UIImagePickerController alloc]init];
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
            self.imagePickerController.delegate = self;

            CameraOverlay *overlay = [[CameraOverlay alloc] initWithFrame:CGRectMake(0, 0, 320, [UI appFrameHeight])];
            overlay.delegate = self;
            self.imagePickerController.cameraOverlayView = overlay;

            int value = SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ? 68 : 48;

            CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, value);
            self.imagePickerController.cameraViewTransform = translate;

            CGAffineTransform scale = CGAffineTransformScale(translate, 1.333333, 1.333333);
            self.imagePickerController.cameraViewTransform = scale;

 [self presentViewController:self.imagePickerController animated:YES completion:nil];

它不显示叠加视图。请任何人帮我解决这个问题。

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,并帮助设置frame这样的Overlay,使用

CameraOverlay *overlay = [CameraOverlay new];
[overlay setFrame:self.imagePickerController.cameraOverlayView.frame]; // important change

而不是

CameraOverlay *overlay = [[CameraOverlay alloc] initWithFrame:CGRectMake(0, 0, 320, [UI appFrameHeight])];

请反馈我......

答案 1 :(得分:0)

最后在link的@Nookaraju答案的帮助下解决了这个问题,通过从应用程序中删除setTitle:方法视图控制器类别来解决此问题。

@implementation UIViewController (CustomeAction)
- (void)setTitle:(NSString *)title{
// YOU CODE///
}
@end

删除了上述代码。