From dd9f507513a5587d8c2e92baf6de6393ca031a84 Mon Sep 17 00:00:00 2001 From: jmkiley Date: Tue, 7 Aug 2018 14:27:45 -0700 Subject: [ios] Added some iOS 8 support --- .../ios/app/MBXOfflinePacksTableViewController.m | 6 +- platform/ios/app/MBXViewController.m | 9 ++- platform/ios/app/Main.storyboard | 72 ++++++++++------------ platform/ios/app/main.m | 1 + platform/ios/benchmark/MBXBenchViewController.mm | 6 +- platform/ios/config.cmake | 2 +- platform/ios/ios.xcodeproj/project.pbxproj | 4 ++ platform/ios/src/MGLScaleBar.mm | 7 ++- 8 files changed, 59 insertions(+), 48 deletions(-) diff --git a/platform/ios/app/MBXOfflinePacksTableViewController.m b/platform/ios/app/MBXOfflinePacksTableViewController.m index 959ae57548..b3f95aef96 100644 --- a/platform/ios/app/MBXOfflinePacksTableViewController.m +++ b/platform/ios/app/MBXOfflinePacksTableViewController.m @@ -119,8 +119,10 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac }]; }]; [alertController addAction:downloadAction]; - alertController.preferredAction = downloadAction; - + if ([alertController respondsToSelector:@selector(preferredAction)]) { + alertController.preferredAction = downloadAction; + } + [self presentViewController:alertController animated:YES completion:nil]; } diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 71bad66aee..c868a5b45e 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -236,7 +236,10 @@ CLLocationCoordinate2D randomWorldCoordinate() { self.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"]; self.mapView.showsScale = YES; self.mapView.showsUserHeadingIndicator = YES; - self.hudLabel.titleLabel.font = [UIFont monospacedDigitSystemFontOfSize:10 weight:UIFontWeightRegular]; + + if ([UIFont respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { + self.hudLabel.titleLabel.font = [UIFont monospacedDigitSystemFontOfSize:10 weight:UIFontWeightRegular]; + } if ([MGLAccountManager accessToken].length) { @@ -266,7 +269,9 @@ CLLocationCoordinate2D randomWorldCoordinate() { [self.mapView reloadStyle:self]; }]; [alertController addAction:OKAction]; - alertController.preferredAction = OKAction; + if ([alertController respondsToSelector:@selector(preferredAction)]) { + alertController.preferredAction = OKAction; + } [self presentViewController:alertController animated:YES completion:nil]; } diff --git a/platform/ios/app/Main.storyboard b/platform/ios/app/Main.storyboard index 3e8a0ad02a..04e4f9ab45 100644 --- a/platform/ios/app/Main.storyboard +++ b/platform/ios/app/Main.storyboard @@ -1,15 +1,14 @@ - + - + - @@ -17,6 +16,10 @@ + + + + @@ -59,11 +62,10 @@ - + - @@ -107,7 +109,6 @@ - @@ -117,7 +118,7 @@ - + @@ -220,6 +221,10 @@ + + + + @@ -337,15 +342,14 @@ - - - - + + + + - - + + - @@ -365,6 +369,10 @@ + + + + @@ -392,33 +400,32 @@ - - - - - + + + + + - - + + - + - + - + - @@ -433,21 +440,6 @@ - - - - - - - - - - - - - - - diff --git a/platform/ios/app/main.m b/platform/ios/app/main.m index 954584f141..2752f493b7 100644 --- a/platform/ios/app/main.m +++ b/platform/ios/app/main.m @@ -1,3 +1,4 @@ + #import #import "MBXAppDelegate.h" diff --git a/platform/ios/benchmark/MBXBenchViewController.mm b/platform/ios/benchmark/MBXBenchViewController.mm index 84c2790d50..6a70b970b5 100644 --- a/platform/ios/benchmark/MBXBenchViewController.mm +++ b/platform/ios/benchmark/MBXBenchViewController.mm @@ -76,8 +76,10 @@ [self startBenchmarkIteration]; }]; [alertController addAction:OKAction]; - alertController.preferredAction = OKAction; - + if ([alertController respondsToSelector:@selector(preferredAction)]) { + alertController.preferredAction = OKAction; + } + [self presentViewController:alertController animated:YES completion:nil]; } } diff --git a/platform/ios/config.cmake b/platform/ios/config.cmake index 6dd3f23a69..4016f695b0 100644 --- a/platform/ios/config.cmake +++ b/platform/ios/config.cmake @@ -1,7 +1,7 @@ add_definitions(-DMBGL_USE_GLES2=1) macro(initialize_ios_target target) - set_xcode_property(${target} IPHONEOS_DEPLOYMENT_TARGET "9.0") + set_xcode_property(${target} IPHONEOS_DEPLOYMENT_TARGET "8.0") set_xcode_property(${target} ENABLE_BITCODE "YES") set_xcode_property(${target} BITCODE_GENERATION_MODE bitcode) set_xcode_property(${target} ONLY_ACTIVE_ARCH $<$:YES>) diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index b77c67fbb3..37ea176fc6 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -3645,6 +3645,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; @@ -3658,6 +3659,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; @@ -3750,6 +3752,7 @@ ); INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_CPLUSPLUSFLAGS = ( @@ -3792,6 +3795,7 @@ ); INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LLVM_LTO = YES; OTHER_CFLAGS = "-fvisibility=hidden"; diff --git a/platform/ios/src/MGLScaleBar.mm b/platform/ios/src/MGLScaleBar.mm index d69fb3e852..0d6b1a58ad 100644 --- a/platform/ios/src/MGLScaleBar.mm +++ b/platform/ios/src/MGLScaleBar.mm @@ -205,7 +205,12 @@ static const CGFloat MGLFeetPerMeter = 3.28084; #pragma mark - Convenience methods - (BOOL)usesRightToLeftLayout { - return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.superview.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft; + if ([self.superview respondsToSelector:@selector(semanticContentAttribute)]) { + return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.superview.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft; + } else { + return UIApplication.sharedApplication.userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; + } + } - (BOOL)usesMetricSystem { -- cgit v1.2.1