How to fix the ratio in custom zoom out in iphone?
<p>I'm new to iPhone, I have custom zoom in and zoom out buttons in the camera view. The zoom in button works great, but zoom out function is not working properly. Why? Please help me any one, thanks.</p>

<p>I tried the following source code:
It's working great, but the zoom out function is not working properly.</p>

<pre><code>- (void)viewDidLoad
{
    [super viewDidLoad];

    buttonView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    buttonView.backgroundColor = [UIColor clearColor];

    zoomin=[UIButton buttonWithType:UIButtonTypeCustom];
    zoomin.frame=CGRectMake(40, 410, 80, 40);
    [zoomin setBackgroundImage:[UIImage imageNamed:@"in.png"] forState:UIControlStateNormal];
    [zoomin addTarget:self action:@selector(CameraZoomIn) forControlEvents:UIControlEventTouchUpInside];
    [buttonView addSubview:zoomin];

    zoomout=[UIButton buttonWithType:UIButtonTypeCustom];
    zoomout.frame=CGRectMake(200, 410, 80, 40);
    [zoomout setBackgroundImage:[UIImage imageNamed:@"out.png"] forState:UIControlStateNormal];
    [zoomout addTarget:self action:@selector(CameraZoomOut) forControlEvents:UIControlEventTouchUpInside];
    [buttonView addSubview:zoomout];
}
- (void) viewDidAppear:(BOOL)animated
{ 
    MyManager *sharedManager = [MyManager sharedManager];
    x = sharedManager.xValue; //x=1.0;
    y = sharedManager.yValue;//y=1.24429;
    imgpicker =[[UIImagePickerController alloc]init];
    imgpicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imgpicker.showsCameraControls=NO;
    imgpicker.navigationBarHidden = YES;

    NSLog(@"X : %f, Y : %f", x , y);
    imgpicker.wantsFullScreenLayout = YES;
    imgpicker.cameraViewTransform =  CGAffineTransformScale(imgpicker.cameraViewTransform, x, y);
    imgpicker.view.userInteractionEnabled=YES;
    imgpicker.cameraOverlayView = buttonView; 
    [self presentModalViewController:imgpicker animated:YES];
    [imgpicker release];
}
-(void)CameraZoomIn
{
    NSLog(@"ZoomIn Pressed In ZoomScreen");
    NSLog(@"X : %f, Y : %f", x , y);
    x = x + 0.5;
    y = y + 0.5;
    NSLog(@"X11 : %f,Y1 : %f", x , y);
    imgpicker.cameraViewTransform = CGAffineTransformScale(imgpicker.cameraViewTransform, x     , y);
}

-(void)CameraZoomOut
{
    NSLog(@"ZoomOut Pressed In ZoomScreen");
    NSLog(@"X : %f, Y : %f", x , y);
    x =x-0.5;
    y =y-0.5;
    NSLog(@"X1 : %f, Y1 : %f", x , y);
    if (x == 0 || y == 0) 
    {
        NSLog(@"X&amp;Y value is below zero");
    }
    else
    {
        imgpicker.cameraViewTransform = CGAffineTransformScale(imgpicker.cameraViewTransform,x,y);
    }
}
</code></pre>
