I'm using the zbar library in my ipad app.
My code looks like below. There I add a square image to the view, so user can point the qrcode inside that box.
My issue is when I rotate the iPad, this square image get misplaced in the landscape mode(not centered properly). So I tried to keep it centered using constraints, but it didn't work. Then I tried to lock it to the portrait mode only. But that also didn't work. It always rotates.
In my viewcontroller class didRotateFromInterfaceOrientation doesn't get called. So I can't even catch when the view rotates. Please let me know what I can do to fix this.
Thank you very much.
ZBarReaderViewController *codeReader = [ZBarReaderViewController new];
codeReader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationPortrait);
ZBarImageScanner *scanner = codeReader.scanner;
codeReader.cameraMode = ZBarReaderControllerCameraModeSampling;
codeReader.sourceType = UIImagePickerControllerSourceTypeCamera;
UIView subView1 = [[UIView alloc]init];
UIImageView imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"camera_target_75.png"]];
codeReader.cameraOverlayView = subView1;
[self presentViewController:codeReader animated:YES completion:nil];