0
我想添加一个覆盖到这个UIImagePickerController实例,但结果是覆盖偏离中心。摄像头覆盖不在中心
我创建了一个简单的红色正方形(300×300磅)举例说明问题,作为一个覆盖并补充说,到相机覆盖,使用这样的:
CGRect bounds = [[UIScreen mainScreen] bounds];
UIView *containerOverlay = [[UIView alloc] initWithFrame:bounds];
UIImage *overlay = [UIImage imageNamed:@"red"];
UIImageView *overlayView = [[UIImageView alloc] initWithImage:overlay];
CGFloat midX = CGRectGetMidX(bounds);
CGFloat midY = CGRectGetMidY(bounds);
CGPoint center = CGPointMake(midX, midY);
overlayView.center = center;
[containerOverlay addSubview:overlayView];
[_camera setCameraOverlayView:containerOverlay];
这就是在现场直播预览...完全离开垂直中心。
令人惊讶,当我拍摄照片和iOS表明我已经拍摄的照片,覆盖奇迹般地中心...
如何我中心对覆盖现场照相机?
这条线告诉你什么? '[_camera setCameraOverlayView:containerOverlay];'overlay **被**添加到'UIImagePickerController'实例中,并且偏离中心。 – SpaceDog 2015-02-09 02:36:19
你是对的,它被添加到cameraOverlayView。但是这个位置是根据屏幕边界计算的。如下所示:您将叠加层的中心设置为屏幕的中心点。 – 2015-02-09 02:45:38
有没有办法获得真正的相机画面?我曾尝试过使用'[_camera.cameraOverlayView frame];'还有'[_camera.view frame]',并且我得到了{0,0,320,568}。任何方式来获取相机图像的坐标? – SpaceDog 2015-02-09 02:50:29