So im trying to make a custom camera within my iOS app.
I want to make the camera full screen like snapchats.
But i cant find anywhere that will help me change the aspect ratio from 4:3 (default) to 16:9 (iPhone 5 & 5s, 4" screens).
Can anyone point me in the right direction?
A little shameless self promotion here, but I have a camera project that does everything you'd like to do, plus you could customize it further for your project. GitHub
It does all the cutting / sizing / aspect ratios for you, while still being fullscreen on all devices.
Otherwise, There's many other options on github / cocoacontrols / elsewhere if you don't like it. You could also make your own by checking out AVFoundation
You need to change the UIImagePickerController's cameraViewTransform:
CGSize screenBounds = [UIScreen mainScreen].bounds.size;
CGFloat cameraAspectRatio = 4.0f/3.0f;
CGFloat camViewHeight = screenBounds.width * cameraAspectRatio;
CGFloat scale = screenBounds.height / camViewHeight;
pickerController.cameraViewTransform = CGAffineTransformMakeTranslation(0, (screenBounds.height - camViewHeight) / 2.0);
pickerController.cameraViewTransform = CGAffineTransformScale(pickerController.cameraViewTransform, scale, scale);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.