Reputation: 11231
I wanted to know if there is anyway, I can customize the size of camera view while using UIImagePickerController. Like when I use the camera option to pick up the image, it takes the whole screen. Instead I want it to take just a square window of 250 by 250. So that rest of the stuff of the screen wont be affected, and you will see the view behind the iPhone by camera in just a small window assigned for the picture.
Is it possible.
Upvotes: 0
Views: 4780
Reputation: 119
in .h
file :
#define CAMERA_TRANSFORM_X 0.70
#define CAMERA_TRANSFORM_Y 0.50
// For screen dimensions:
#define SCREEN_WIDTH 100
#define SCREEN_HEIGTH 100
In .m
file ,In ViewWillAppear
method :
- (void) viewDidAppear:(BOOL)animated
{
OverlayView *overlay = [[OverlayView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];
// Create a new image picker instance:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
// Set the image picker source:
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
// Hide the controls:
picker.showsCameraControls = NO;
picker.navigationBarHidden = NO;
//[[[self captureManager] previewLayer] setBounds:CGRectMake(0,0,320,480)]; // Make camera view full screen:
picker.wantsFullScreenLayout = normal;
picker.cameraOverlayView =CGRectMinXEdge;
picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
//picker.cameraViewTransform=CGAffineTransformMakeTranslation(CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
// Insert the overlay:
//picker.cameraOverlayView = overlay;
// Show the picker:
[self presentModalViewController:picker animated:YES];
[picker release];
[super viewDidAppear:YES];
}
Upvotes: -1
Reputation: 21760
Here's an example for how to customize the camera overlay by Jason Job.
http://www.musicalgeometry.com/?p=821
or Just do a search for UIImagePickerController camera overlay
Upvotes: 3