Reputation: 1868
I'm initializing an UIImagePickerController like this:
self.cameraController = [[UIImagePickerController alloc] init];
self.cameraController.sourceType = UIImagePickerControllerSourceTypeCamera;
self.cameraController.showsCameraControls = NO;
self.cameraController.navigationBarHidden = YES;
self.cameraController.wantsFullScreenLayout = YES;
The problem is that when this is shown, instead of the camera controls, I get a black bar in its place.
How can I make UIImagePickerController.frame take all the screen space?
Thanks!
Upvotes: 2
Views: 2655
Reputation: 1867
Ole is spot on, figure out that aspect ratio conversion. Here is the line of code you are probably going to want to implement it.
self.cameraController.cameraViewTransform = CGAffineTransformScale(CGAffineTransformIdentity, 2, 2);
Upvotes: 1
Reputation: 135588
The iPhone's camera has a 4:3 aspect ratio whereas the iPhone's screen's aspect ratio is 3:2. Therefore, the live camera picture does not cover the entire screen. If you want to get rid of the black bars, you have to apply a small scaling transform (e.g. 110%) to the camera view.
Upvotes: 5