我们怎样才能在相机上带矩形条码扫描,就像扫描红色激光一样?有没有内置房产?我试过以下:
reader.readerView.tracksSymbols = YES;
reader.readerView.trackingColor = [UIColor redColor];
[reader setShowsZBarControls:NO];
reader.readerView.tracksSymbols = TRUE;
scanner.accessibilityFrame = CGRectMake(100, 100, 200, 300);
答案 0 :(得分:2)
在相机视图中添加rectange作为叠加层。这是代码:
- (IBAction) scanButtonTapped
{
// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
ZBarImageScanner *scanner = reader.scanner;
reader.showsZBarControls = NO;
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
// present and release the controller
[self presentModalViewController: reader
animated: YES];
reader.cameraOverlayView = [self CommomOverlay];
[reader release];
}
-(UIView*)CommomOverlay{
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
UIImageView *FrameImg = [[UIImageView alloc] initWithFrame:CGRectMake(70,160,203,180)];
[FrameImg setImage:[UIImage imageNamed:@"overlaygraphic.png"]];
[view addSubview:FrameImg];
return view;
}
希望这会对你有所帮助.. :)
答案 1 :(得分:0)
你试过吗
reader.cameraOverlayView = overLayView;
??即cameraOverlayView
的{{1}}属性。
在那里你可以设置你想要的东西。希望这是你想要的。