二维码 - iOS7 自带的扫码,怎么设置全屏显示,但是实际扫描区域只在一个框内
巴扎黑
巴扎黑 2017-04-17 13:36:20
0
3
1106

就是类似zbarsdk中哦个ZBarReaderView的scanCrop属性,找了半天文档了,不知道有没有什么方法实现

巴扎黑
巴扎黑

reply all(3)
Ty80

After reading this article you will know, it is very simple, you can get the full screen scanning effect you want

http://www.appcoda.com/qr-code-ios-programming-tutorial/

洪涛

Specially registered an account to answer this question. You should read the document carefully for the title. I didn’t read the document just because I believed you and couldn’t find it after searching for a long time. (I also blame me for not reading the post carefully, so I wasted a lot. Time, I actually saw the article "IOS QR code scanning, two things you need to pay attention to" a long time ago), and I suddenly found the rectOfInterest attribute after reading the document this morning.
Solution:
_output = [[AVCaptureMetadataOutput alloc]init];
CGSize size = self.view.bounds.size;
CGRect cropRect = CGRectMake(50, 160, 220, 220);
CGFloat p1 = size.height/size.width;
CGFloat p2 = 1920./1080.; //Using 1080p image output
if (p1 < p2) {
CGFloat fixHeight = self.view.bounds.size.width * 1920. / 1080.;
CGFloat fixPadding = (fixHeight - size.height)/2;
_output.rectOfInterest = CGRectMake((cropRect.origin.y + fixPadding)/fixHeight,
cropRect.origin.x/size.width,
cropRect.size.height/fixHeight,
cropRect.size.width/size.width);
} else {
CGFloat fixWidth = self.view.bounds.size.height * 1080. / 1920.;
CGFloat fixPadding = (fixWidth - size.width)/2;
_output.rectOfInterest = CGRectMake(cropRect.origin.y/size.height,
(cropRect.origin.x + fixPadding)/fixWidth,
cropRect.size.height/size.height,
cropRect.size.width/fixWidth);
}

参考:
IOS二维码扫描,你需要注意的两件事
http://blog.cnbluebox.com/blog/2014/08/26/ioser-wei-ma-sao-miao/
洪涛

01. It’s very simple. There is a function that draws the interface on this ViewController. Just add a border on the interface and leave only a small area. The disadvantage is that sometimes the QR code can be recognized even if it is displayed in the frame. , weird, but it’s okay;

02. The troublesome thing is to put this ViewController into another ViewController;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!