diff --git a/openbis-ipad/source/objc/BisKit/Classes/CISDOBSplitViewController.m b/openbis-ipad/source/objc/BisKit/Classes/CISDOBSplitViewController.m index 711ab03890f1a7ba4153ac64f5f596bc6516dcd4..0784952b7ecfe2093385925f589d8e388a60e4b8 100644 --- a/openbis-ipad/source/objc/BisKit/Classes/CISDOBSplitViewController.m +++ b/openbis-ipad/source/objc/BisKit/Classes/CISDOBSplitViewController.m @@ -29,8 +29,13 @@ // Do any additional setup after loading the view. [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(switchAutoRotate:) - name:@"BarcodeReaderSwitchAutoRotation" + selector:@selector(switchAutoRotateOn:) + name:@"BarcodeReaderSwitchAutoRotationOn" + object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(switchAutoRotateOff:) + name:@"BarcodeReaderSwitchAutoRotationOff" object:nil]; } @@ -42,9 +47,14 @@ static BOOL shouldAutorotate = YES; -- (void) switchAutoRotate:(NSNotification *) notification +- (void) switchAutoRotateOn:(NSNotification *) notification +{ + shouldAutorotate = YES; +} + +- (void) switchAutoRotateOff:(NSNotification *) notification { - shouldAutorotate = !shouldAutorotate; + shouldAutorotate = NO; } - (BOOL)shouldAutorotate diff --git a/openbis-ipad/source/objc/openBIS/openBIS/CISDOBBarcodeViewController.m b/openbis-ipad/source/objc/openBIS/openBIS/CISDOBBarcodeViewController.m index bb2bb0a310c0e7618c215d8c52da4ab909439bad..240417112f95f8346241bc7a8b85614cbb92fa9d 100644 --- a/openbis-ipad/source/objc/openBIS/openBIS/CISDOBBarcodeViewController.m +++ b/openbis-ipad/source/objc/openBIS/openBIS/CISDOBBarcodeViewController.m @@ -50,7 +50,7 @@ postNotificationName:@"DissmissNotification" object:nil]; [[NSNotificationCenter defaultCenter] - postNotificationName:@"BarcodeReaderSwitchAutoRotation" + postNotificationName:@"BarcodeReaderSwitchAutoRotationOn" object:nil]; } @@ -70,9 +70,6 @@ #pragma mark - View Controller Methods - (void)viewWillAppear:(BOOL)animated { - [[NSNotificationCenter defaultCenter] - postNotificationName:@"BarcodeReaderSwitchAutoRotation" - object:nil]; /* self.videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; NSError *error; diff --git a/openbis-ipad/source/objc/openBIS/openBIS/CISDOBMasterViewController.m b/openbis-ipad/source/objc/openBIS/openBIS/CISDOBMasterViewController.m index ee0b4f551d355cdaf615135f5fc6c6b779633057..e7e6d3a7fc5f9cff07f71e7d44acf4ab3c2ac52a 100644 --- a/openbis-ipad/source/objc/openBIS/openBIS/CISDOBMasterViewController.m +++ b/openbis-ipad/source/objc/openBIS/openBIS/CISDOBMasterViewController.m @@ -341,6 +341,9 @@ //Searching for barcodes or normal search NSString* searchTitle = [self scopeButtonTitles][searchOption]; if ([searchTitle isEqualToString:@"Barcode"]) { + [[NSNotificationCenter defaultCenter] + postNotificationName:@"BarcodeReaderSwitchAutoRotationOff" + object:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil]; CISDOBBarcodeViewController *barcodeController = [storyboard instantiateViewControllerWithIdentifier:@"Barcode"]; barcodeController.modalPresentationStyle = UIModalPresentationFullScreen;