From 894cb50d7fa232cdda5b19420fa6c1fae9922a8c Mon Sep 17 00:00:00 2001 From: Elad Moshe Date: Sun, 31 Jul 2016 17:59:49 +0300 Subject: [PATCH] fixed to correctly hide info button on iOS 10.0+. Previous version was crashing the app --- ios/CsZBar.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ios/CsZBar.m b/ios/CsZBar.m index c7f8a26..45a15ab 100644 --- a/ios/CsZBar.m +++ b/ios/CsZBar.m @@ -72,7 +72,13 @@ } // Hack to hide the bottom bar's Info button... originally based on http://stackoverflow.com/a/16353530 - UIView *infoButton = [[[[[self.scanReader.view.subviews objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:3]; + NSInteger infoButtonIndex; + if ([[[UIDevice currentDevice] systemVersion] compare:@"10.0" options:NSNumericSearch] != NSOrderedAscending) { + infoButtonIndex = 1; + } else { + infoButtonIndex = 3; + } + UIView *infoButton = [[[[[self.scanReader.view.subviews objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:infoButtonIndex]; [infoButton setHidden:YES]; //UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; [button setTitle:@"Press Me" forState:UIControlStateNormal]; [button sizeToFit]; [self.view addSubview:button];