1

I have an IPAD application which is supporting only in landscape mode. In which i wanted to use ZbarSDK for reading bar codes,i created a view in my view controller then load it with background of the readerviewcontroller.working fine in iphone.But in ipad with this orientations it is behaving strage,like loading in portrait mode,etc.I am using this but no luck.reader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationLandscapeRightcan anybody help me how to use this sdk correctly in ipad with landscape orientations?

4

3 回答 3

2

我刚刚遇到嵌入式阅读器视图的问题,并读到在旋转时缺少对 setNeedsLayout 的调用,不确定它是否会对某人有所帮助,但这是解决我的问题的方法

- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient duration:     (NSTimeInterval) duration
{
    [self.readerView willRotateToInterfaceOrientation:orient  duration:duration];
    [self.readerView setNeedsLayout];
}
于 2013-08-15T14:49:57.213 回答
0

Works fine for me. Our iPad app supports only Landscape orientation:

// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
ScanOverlay overlayController = [[ScanOverlay alloc] initWithNibName:@"ScanOverlay" bundle:nil];
reader.cameraOverlayView = overlayController.view;
ZBarImageScanner *scanner = reader.scanner;
// TODO: (optional) additional reader configuration here
reader.supportedOrientationsMask = UIInterfaceOrientationMaskLandscape;
reader.wantsFullScreenLayout = YES;
reader.showsZBarControls = NO;  //If we don't set this to NO, the overlay may not display at all
reader.tracksSymbols = YES;
[overlayController willRotateToInterfaceOrientation:YES duration:0.5];

// ADD: present a barcode reader that scans from the camera feed

// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
               config: ZBAR_CFG_ENABLE
                   to: 0];

//Show the scanner view    
if([self respondsToSelector:@selector(presentViewController:animated:completion:)]){
    [self presentViewController:reader animated:YES completion:^(void){}];
} else if([self respondsToSelector:@selector(presentModalViewController:animated:)]) {
    [self presentModalViewController:reader animated:YES];
} else {
    NSLog(@"Error! Can't present the View Controller");
}
于 2013-02-27T13:55:51.920 回答
0

我认为使用下面的代码可以帮助你......

ZBarReaderViewController *reader = [ZBarReaderViewController new];
[reader shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];

希望,这对你有帮助.. :)

于 2012-06-09T07:13:11.250 回答