ios中的条形码扫描可以用zxing吗
2个回答
展开全部
扫描框的大小就是修改CameraManager的四个常量
距离聚焦这个最好就不要去设置了,因为都是自己聚焦的
z
距离聚焦这个最好就不要去设置了,因为都是自己聚焦的
z
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2017-05-31
展开全部
如何使ZXing改改后可以支持扫条形码。
1.在- (IBAction)scanPressed:(id)sender方法中:
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:YES];
MultiFormatOneDReader *OneReaders=[[MultiFormatOneDReader alloc]init]; QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init]; NSSet *readers = [[NSSet alloc ] initWithObjects:OneReaders,qrcodeReader,nil];
[qrcodeReader release];
[OneReaders release];
2.在ZXingWidgetController.m的 (void)captureOutput:(AVCaptureOutput *)captureOutput :方法中,注释掉以下方法
if (oneDMode) {
// let's just give the decoder a vertical band right above the red line
cropRect.origin.x = cropRect.origin.x + (cropRect.size.width / 2) - (ONE_D_BAND_HEIGHT + 1);
cropRect.size.width = ONE_D_BAND_HEIGHT;
// do a rotate
CGImageRef croppedImg = CGImageCreateWithImageInRect(capture, cropRect);
capture = [self CGImageRotated90:croppedImg];
capture = [self CGImageRotated180:capture];
// UIImageWriteToSavedPhotosAlbum([UIImage imageWithCGImage:capture], nil, nil, nil);
CGImageRelease(croppedImg);
cropRect.origin.x = 0.0;
cropRect.origin.y = 0.0;
cropRect.size.width = CGImageGetWidth(capture);
cropRect.size.height = CGImageGetHeight(capture);
}
3. 将上面注释掉的代码向下数大概约20行处的代码:
UIImage *scrn = [[UIImage alloc] initWithCGImage:newImage];
改为:
int backCameraImageOrientation = UIImageOrientationRight;
UIImage *scrn = [[UIImage alloc] initWithCGImage:newImage scale:
(CGFloat)1.0 orientation:backCameraImageOrientation];
4. 在OverlayView.m注释代码以下代码:
self.oneDMode = isOneDModeEnabled;
1.在- (IBAction)scanPressed:(id)sender方法中:
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:YES];
MultiFormatOneDReader *OneReaders=[[MultiFormatOneDReader alloc]init]; QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init]; NSSet *readers = [[NSSet alloc ] initWithObjects:OneReaders,qrcodeReader,nil];
[qrcodeReader release];
[OneReaders release];
2.在ZXingWidgetController.m的 (void)captureOutput:(AVCaptureOutput *)captureOutput :方法中,注释掉以下方法
if (oneDMode) {
// let's just give the decoder a vertical band right above the red line
cropRect.origin.x = cropRect.origin.x + (cropRect.size.width / 2) - (ONE_D_BAND_HEIGHT + 1);
cropRect.size.width = ONE_D_BAND_HEIGHT;
// do a rotate
CGImageRef croppedImg = CGImageCreateWithImageInRect(capture, cropRect);
capture = [self CGImageRotated90:croppedImg];
capture = [self CGImageRotated180:capture];
// UIImageWriteToSavedPhotosAlbum([UIImage imageWithCGImage:capture], nil, nil, nil);
CGImageRelease(croppedImg);
cropRect.origin.x = 0.0;
cropRect.origin.y = 0.0;
cropRect.size.width = CGImageGetWidth(capture);
cropRect.size.height = CGImageGetHeight(capture);
}
3. 将上面注释掉的代码向下数大概约20行处的代码:
UIImage *scrn = [[UIImage alloc] initWithCGImage:newImage];
改为:
int backCameraImageOrientation = UIImageOrientationRight;
UIImage *scrn = [[UIImage alloc] initWithCGImage:newImage scale:
(CGFloat)1.0 orientation:backCameraImageOrientation];
4. 在OverlayView.m注释代码以下代码:
self.oneDMode = isOneDModeEnabled;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询