ZBar scanner: iOS 6.0 restrict auto rotation within ZBarReaderViewController ?

do a category forwarding the decision to the currently active view controller.


ZBarReaderViewController+Rotation.h:

#import "ZBarReaderViewController.h"

@interface ZBarReaderViewController (Rotation)

@end


ZBarReaderViewController+Rotation.m:

#import "ZBarReaderViewController+Rotation.h"

@implementation ZBarReaderViewController (Rotation)

#pragma mark - IOS 6 Rotation

- (BOOL)shouldAutorotate {
    if (supportedOrientationsMask == ZBarOrientationMaskAll) {
        return YES;
    }
    else{
        return NO;
    }
    
}

- (NSUInteger)supportedInterfaceOrientations {
    return ZBarOrientationMaskAll;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}


@end


参考:http://stackoverflow.com/questions/12954087/ios-6-0-restrict-auto-rotation-within-a-navigation-controller

            http://stackoverflow.com/questions/12503658/top-home-button-portrait-orientation-in-ios6-simulator-not-working/12518577#12518577

你可能感兴趣的:(ZBar scanner: iOS 6.0 restrict auto rotation within ZBarReaderViewController ?)