The reason for this is because the aspect ratio of camera and the screen is different. for e.g. 4:3 while of the screen is 3:2. To fill in the screen, the picture from camera needs to be cropped to the aspect ratio of screen. To dynamically compute it, below is the code.
references:
http://stackoverflow.com/questions/2674375/uiimagepickercontroller-doesnt-fill-screen
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = NO;
self.picker.navigationBarHidden = YES;
self.picker.toolbarHidden = YES;
self.picker.cameraViewTransform = CGAffineTransformMakeTranslation(0, (screenBounds.height - camViewHeight) / 2.0);
self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, scale, scale);
http://stackoverflow.com/questions/2674375/uiimagepickercontroller-doesnt-fill-screen
No comments:
Post a Comment