How can we scale the camera screen programmatically in the iphone?
Is it possible to programmatically zoom in on the camera, I checked the APi provided by Apple for this, but there is no API for camera scaling in the SDK. The scrolling view only has a zoom function, is there a way that we can zoom in on the image from our camera.
Even some apps in the store have a zoom feature, not how it is possible.
source to share
Here is my solution: First you need to have a view where you will be setting your controls (you can write this in your viewDidLoad method):
UIView *miControllingView = [[UIView alloc]initWithFrame:CGRectMake(x,y,width,height)];
Then you implement a slider with values ββfrom 1 to 5 (this will cause my image to increase its size from 1x to 5x). Define this element in your .h file so that you can access its value throughout the class:
zoom = [[UISlider alloc]initWithFrame:CGRectMake(sliderX, sliderY, sliderWidth, sliderHeight)];
[zoom setMaximumValue:5];
[zoom setMinimumValue:1];
[zoom setContinuous:YES];
[zoom addTarget:self action:@selector(zoomChange) forControlEvents:UIControlEventValueChanged];
[myControllingView addSubview:zoom];
Then you need to add your control view to the camera view with this:
[myPicker setCameraOverlayView:myControllingView];
Finally, define the behavior of the selector:
-(void)zoomChange{
[myPicker setCameraViewTransform:CGAffineTransformMakeScale([zoom value],[zoom value])];}
This works great for me.
PS I also hide the camera controls so it looks like this:
myPicker.showsCameraControls = NO;
source to share