7
votes

I have an simple UIImagePickerController where I hide the camera controls and set the sourceType to the camera. This opens the live camera preview right away but there's about a 50px hight black bar at the bottom of the viewer. Any idea how to get rid of this?

2
it is simply WHERE THE CAMERA IMAGE ENDS. the camera is 4:3 but modern iPhones are much "longer" than that.Fattie

2 Answers

4
votes

Thanks Usman for the link. The ratio seems to be a bit different from what's suggested in the blog. The ratio of 1.23 works for iPhone 4 and 4s. Also, in order to preserve the aspect ratio, I suggest scaling both x and y.

    picker = [[UIImagePickerController alloc] init];
    picker.sourceType = sourceType;
    picker.delegate = self;
    picker.allowsEditing = NO;
    picker.showsCameraControls = NO;
    CGAffineTransform cameraTransform = CGAffineTransformMakeScale(1.23, 1.23);
    picker.cameraViewTransform = cameraTransform;
0
votes

I believe this is due to the differing aspect ratio of the camera vs. the iPhone screen.