Yuvaraj.M
Yuvaraj.M

Reputation: 9801

How to Custom the ZoomIn and ZoomOut functionality with using UIButtons and UIImagePickerCameraControl in iPhone Camera?

I am new to use UIImagePickerController in iPhone applications. I have added two UIButtons in an UIView and set that view as UIImagePickerController's overlayview. When the user hit ZoomIn button the camera image should zoomin and when the user hit ZoomOut button the camera image should zoomout. I have tried this below code, but it is not working.

imgpicker.wantsFullScreenLayout = YES;
imgpicker.cameraViewTransform = CGAffineTransformScale(imgpicker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
imgpicker.view.userInteractionEnabled=YES;

CAMERA_TRANSFORM_X 1 CAMERA_TRANSFORM_Y 1.24299

imgpicker.cameraViewTransform = CGAffineTransformScale(imgpicker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y); I have used this line in both two buttons click events. In zoomin i have used,

imgpicker.cameraViewTransform = CGAffineTransformScale(imgpicker.cameraViewTransform, CAMERA_TRANSFORM_X+1.0, CAMERA_TRANSFORM_Y+1.0);

and in Zoomout i have used,

imgpicker.cameraViewTransform = CGAffineTransformScale(imgpicker.cameraViewTransform, CAMERA_TRANSFORM_X-1.0, CAMERA_TRANSFORM_Y-1.0);

Can you please suggest the sample code or ideas to solve the problem? Please help me. Thanks in advance.

Upvotes: 0

Views: 510

Answers (1)

Yuvaraj.M
Yuvaraj.M

Reputation: 9801

Thanks for your interest on my question. I found the answer for my own question. I did a blind work on this that is why i can't get a correct expected output. I was placed ZoomIn and ZoomOut button in a UIView(OverlayView) class, so i tried to invoke UIImagePickerController from this UIView that was the problem. Now, i created UIView in locally and placed the both two buttons in this UIView. Now, i called the UIImagePickerController from locally, so it works nice what am expected.

X = 1.00;
Y = 1.24299;

imgpicker.cameraViewTransform = CGAffineTransformScale(imgpicker.cameraViewTransform, X, Y);

X = X + 1.00;
Y = Y + 1.24299;

this is for ZoomIn and change the values X = X - 1.00; Y = Y - 1.24299; for ZoomOut function. X and Y are Float datatypes.

Thanks.

Upvotes: 1

Related Questions