hacker
hacker

Reputation: 8947

ZBar SDK orientation Issue in Ipad?

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?

Upvotes: 1

Views: 1947

Answers (3)

michael23
michael23

Reputation: 3934

I have just had problems with the embedded reader view and read that a call to setNeedsLayout was missing on rotation, not sure if it will help someone but here is what fixed my problems

- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient duration:     (NSTimeInterval) duration
{
    [self.readerView willRotateToInterfaceOrientation:orient  duration:duration];
    [self.readerView setNeedsLayout];
}

Upvotes: 2

Joe M
Joe M

Reputation: 677

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");
}

Upvotes: 0

Paras Joshi
Paras Joshi

Reputation: 20541

i think use bellow code may this help you...

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

hope,this help you.. :)

Upvotes: 0

Related Questions