Custom camera zoom functionality on iPhone

2020-02-26 13:30发布

I am new to XCode. I am trying to develop a custom camera with an overlay view . I am able to load this well and it's working great.

Now I want to add zoom functionality activated with a button on the overlay view.

Can any one guide me? I'm trying to find out how to zoom the camera, but I haven not bene able to find anything.

Thank you

1条回答
Deceive 欺骗
2楼-- · 2020-02-26 14:16

You can use cameraViewTransform property :

cameraViewTransform The transform to apply to the camera’s preview image.

@property(nonatomic) CGAffineTransform cameraViewTransform Discussion This transform affects the live preview image only and does not affect your custom overlay view or the default image picker controls. You can use this property in conjunction with custom controls to implement your own electronic zoom behaviors.

You can access this property only when the source type of the image picker is set to UIImagePickerControllerSourceTypeCamera. Attempting to access this property for other source types results in the throwing of an NSInvalidArgumentException exception.

Availability Available in iOS 3.1 and later. Declared In UIImagePickerController.h

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

查看更多
登录 后发表回答