由于原生的二维码扫描,响应速度特别快,全屏扫描区域的话会出现二维码图像在屏幕边界的时候就会识别,影响使用体验,所以要更改一下识别区域的大小
输出流AVCaptureMetadata有这么一个属性rectOfInterest 就是它的识别区域大小属性,这是它的描述:
/*!
@property rectOfInterest
@abstract
Specifies a rectangle of interest for limiting the search area for visual metadata.
@discussion
The value of this property is a CGRect that determines the receiver's rectangle of interest for each frame of video. The rectangle's origin is top left and is relative to the coordinate space of the device providing the metadata. Specifying a rectOfInterest may improve detection performance for certain types of metadata.The default value of this property is the value CGRectMake(0, 0, 1, 1). Metadata objects whose bounds do not intersect with the rectOfInterest will not be returned.
*/