Does anyone know how to set the interface orientation for the ZBar SDK? I need it to work in landscape view and not portrait. I tried adding [reader shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
but it didn't work. Any ideas?
Asked
Active
Viewed 1,790 times
0

user1486548
- 1,201
- 4
- 15
- 22
3 Answers
2
Create a wrapper class around ZBarReaderView and add the iOS 6 methods:
-(BOOL) shouldAutorotate
{
return NO;
}
-(NSUInteger) supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
Then use the class you created over the built in ZBar one, make sure you keep the old iOS 5 methods in the same controller:
- (BOOL)shouldAutorotateToInterfaceOrientation (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscape);
}
and also:
self.reader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationMaskLandscape);
I know it's late, but I just got around to doing this myself for iOS 6.

Holyprin
- 348
- 1
- 9
2
I got the same issue and resolved it symply !
I just needed to call :
[reader willRotateToInterfaceOrientation: toInterfaceOrientation duration: duration];
within the willRotate... of the view controller that contains the ZbarReaderView.

user2241649
- 81
- 1
- 3
0
I'm not sure exactly what you mean but maybe this help you ...
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft animated:NO];
or
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];

Dekel Maman
- 2,077
- 1
- 15
- 16