저는 내 응용 프로그램에서 카메라 오버레이보기를 구현했습니다. 카메라 오버레이보기는 iOS 9.에서 잘 작동하지만 iOS 10 cameraView 변형은이 문제를 해결하는 방법을 사용하지 않습니다. 제발 나를 안내 해줘. 감사합니다UIImagePickerController cameraViewTransform이 iOS 10에서 작동하지 않습니다.
내 작업 코드
CGSize screenBounds = [UIScreen mainScreen].bounds.size;
CGFloat cameraAspectRatio = 4.0f/3.0f;
CGFloat camViewHeight = screenBounds.width * cameraAspectRatio;
CGFloat scale = screenBounds.height/camViewHeight;
picker.cameraViewTransform = CGAffineTransformMakeTranslation(0, (screenBounds.height - camViewHeight)/2.0);
picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, scale, scale);
갱신
OverlayView *overlay = [[OverlayView alloc]
initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
picker =
[[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = NO;
picker.navigationBarHidden = NO;
picker.toolbarHidden = YES;
// Device's screen size (ignoring rotation intentionally):
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
float cameraAspectRatio = 4.0/3.0;
float imageWidth = floorf(screenSize.width * cameraAspectRatio);
float scale = ceilf((screenSize.height/imageWidth) * 10.0)/10.0;
picker.cameraViewTransform = CGAffineTransformScale(CGAffineTransformIdentity, 2, 2);
picker.cameraOverlayView = overlay;
picker.allowsEditing = NO;
UIPinchGestureRecognizer *pinchRec = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(zoom:)];
[overlay addGestureRecognizer:pinchRec];
overlay.image =image;
[self.navigationController presentViewController:picker animated:NO completion:nil];
감사합니다. @Jamshed Alam을 확인하고 업데이트합니다. –
ok. 다시 문제가 발생하면 알려주세요. –
코드를 사용했지만 여전히 Jamshed Alam을 사용하지 않았습니다. –