diff --git a/include/mbgl/ios/MGLMapView+IBAdditions.h b/include/mbgl/ios/MGLMapView+IBAdditions.h index fdd1ea350..df9a19a6b 100644 --- a/include/mbgl/ios/MGLMapView+IBAdditions.h +++ b/include/mbgl/ios/MGLMapView+IBAdditions.h @@ -11,7 +11,7 @@ @property (nonatomic) IBInspectable NSString *accessToken; @property (nonatomic) IBInspectable NSString *mapID; -// Some convenience properties related to the initial viewport. These properties +// Convenience properties related to the initial viewport. These properties // are not meant to be used outside of Interface Builder. latitude and longitude // are backed by properties of type CLLocationDegrees, but these declarations // must use the type double because Interface Builder is unaware that @@ -21,4 +21,13 @@ @property (nonatomic) IBInspectable double longitude; @property (nonatomic) IBInspectable double zoomLevel; +// Renamed properties. Interface Builder derives the display name of each +// inspectable from the runtime name, but runtime names don’t always make sense +// in UI. + +@property (nonatomic) IBInspectable BOOL allowsZooming; +@property (nonatomic) IBInspectable BOOL allowsScrolling; +@property (nonatomic) IBInspectable BOOL allowsRotating; +@property (nonatomic) IBInspectable BOOL showsUserLocation; + @end diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 18937b94f..741f659ad 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -1064,6 +1064,21 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; #pragma mark - Properties - ++ (NSSet *)keyPathsForValuesAffectingZoomEnabled +{ + return [NSSet setWithObject:@"allowsZooming"]; +} + ++ (NSSet *)keyPathsForValuesAffectingScrollEnabled +{ + return [NSSet setWithObject:@"allowsScrolling"]; +} + ++ (NSSet *)keyPathsForValuesAffectingRotateEnabled +{ + return [NSSet setWithObject:@"allowsRotating"]; +} + #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-parameter" @@ -2463,4 +2478,49 @@ class MBGLView : public mbgl::View } } ++ (NSSet *)keyPathsForValuesAffectingAllowsZooming +{ + return [NSSet setWithObject:@"zoomEnabled"]; +} + +- (BOOL)allowsZooming +{ + return self.zoomEnabled; +} + +- (void)setAllowsZooming:(BOOL)allowsZooming +{ + self.zoomEnabled = allowsZooming; +} + ++ (NSSet *)keyPathsForValuesAffectingAllowsScrolling +{ + return [NSSet setWithObject:@"scrollEnabled"]; +} + +- (BOOL)allowsScrolling +{ + return self.scrollEnabled; +} + +- (void)setAllowsScrolling:(BOOL)allowsScrolling +{ + self.scrollEnabled = allowsScrolling; +} + ++ (NSSet *)keyPathsForValuesAffectingAllowsRotating +{ + return [NSSet setWithObject:@"rotateEnabled"]; +} + +- (BOOL)allowsRotating +{ + return self.rotateEnabled; +} + +- (void)setAllowsRotating:(BOOL)allowsRotating +{ + self.rotateEnabled = allowsRotating; +} + @end