iPhone 上的自定义相机缩放功能 [英] Custom camera zoom functionality on iPhone

查看:18
本文介绍了iPhone 上的自定义相机缩放功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 XCode 的新手.我正在尝试开发具有叠加视图的自定义相机.我能够很好地加载它并且它工作得很好.

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.

谢谢

推荐答案

你可以使用 cameraViewTransform 属性:

cameraViewTransform 转换为应用于相机的预览图像.

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

@property(nonatomic) CGAffineTransformcameraViewTransform 讨论这个变换影响实时预览仅图像,不影响您的自定义覆盖视图或默认图像选择器控件.您可以使用此属性与自定义控件来实现您自己的电子变焦行为.

@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.

您只能在以下情况下访问此属性图像选择器的源类型是设置UIImagePickerControllerSourceTypeCamera.尝试访问此属性其他源类型导致投掷NSInvalidArgumentException 异常.

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.

可用性 适用于 iOS 3.1 和之后.宣布于UIImagePickerController.h

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

这篇关于iPhone 上的自定义相机缩放功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆