这段代码在我机器上运行貌似一直出错,我后来是这样写的:
//写了这几句话 貌似远点了 1224日
[self.captureSession beginConfiguration];
self.device.videoZoomFactor = 50.0f;
AVCaptureStillImageOutput* output = (AVCaptureStillImageOutput*)[self.captureSession.outputs objectAtIndex:0];
AVCaptureConnection *videoConnection = [output connectionWithMediaType:AVMediaTypeVideo];
CGFloat maxScale = videoConnection.videoMaxScaleAndCropFactor;
CGFloat zoom = maxScale / 50;
// videoConnection.videoScaleAndCropFactor -= zoom;
videoConnection.videoScaleAndCropFactor = 1.0f;
[self.captureSession commitConfiguration];
转载自:http://blog.csdn.net/song_yu_tao/article/details/17305601
自己用avcapture实现自定制相机,系统相机是可以拉近拉远镜头的,网上搜寻了半天始终没有发现,刚才又翻看了半天的api接口,终于找到了,原来他藏在AVCaptureConnection中,videoScaleAndCropFactor:缩放裁剪系数。简单写了下使用方法: