I'm trying to accomplish the following result:
Set the frame of my UIImagePickerController to, lets say 200 x 200,
Set my frame at the bottom-right corner (just like Facetime/Skype does)
and show the front/rear (doesn't matter) camera stream.
Here's my code, for some reason, setFrame is not working!
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.view.frame = CGRectMake(600, 400, 200, 200); // NOT WORKING !!!
self.picker.toolbarHidden = YES;
self.picker.wantsFullScreenLayout = NO;
self.picker.delegate = delegate;
[self presentViewController:self.picker animated:YES completion:nil];
I've looked at similar SO topics but they all talk about how to
set a view on top of the UIImagePickerController, not my problem at all.
I've tried adding self.picker to a custom UIView sized 200 x 200 but still
no success.
What am i doing wrong here?
Thanks
From UIViewController reference link
presentViewController:animated:completion:
Discussion
On iPhone and iPod touch, the presented view is always full screen
If you want to embed image picker, you should manually add its view to one of your other views.
like this
I experimented with the code from my last post, and commented out the final scale transform ((the one which makes it full size) and I ended up with a lovely miniature camera imagePicker floating in the middle of my screen, so it definitely does work! The exact code I used, including the zoom/fade-in transition, is -
You need to use the
cameraViewTransform
property ofUIImagePicker
to adjust its camera frame. This property accept anyCGAffineTransform
you made (e.g. scaling, rotating, inverting, translating, etc).For example, if you want to move the camera view down by 50 points and scale the camera view 1.2x its original size, this is how you'll do it: