1

I would like to use the ZXing iOS framework to bring barcode scanning to my iOS application.

After downloading the Github project (https://github.com/TheLevelUp/ZXingObjC) I played around with the iOS demo project.

In the demo project the phone camera is fullscreen - for my needs I would like to adjust the size of the camera.

ZXing is using the class 'ZXCapture' for doing live barcode scanning. The demo app has the following viewDidLoad function:

- (void)viewDidLoad {
    [super viewDidLoad];

    self.capture = [[ZXCapture alloc] init];
    self.capture.camera = self.capture.back;
    self.capture.focusMode = AVCaptureFocusModeContinuousAutoFocus;

    // here I tried to change the size of the camera 
    self.capture.layer.frame = CGRectMake(0, 0, 200, 200);

    [self.view.layer addSublayer:self.capture.layer];

    [self.view bringSubviewToFront:self.scanRectView];
    [self.view bringSubviewToFront:self.decodedLabel];
} 

As you can see, I added a line of code to change the size of the capture frame. Without success... (I also tried to add the capture layer to a custom sized UIView - also without success - the camera still has a fixed size)

Has anybody ever had the same problem or use case with ZXing for iOS? Or dose anybody has an idea to do what I want?

Laurenz Glück
  • 1,762
  • 3
  • 17
  • 38

0 Answers0