Inspectable toggles

Added inspectables for toggling zooming, panning, rotating, and showing the user location for parity with `MKMapView`.
This commit is contained in:
Minh Nguyễn
2015-04-03 00:13:34 -07:00
parent 6eb79338f3
commit d1fb43e371
2 changed files with 70 additions and 1 deletions

View File

@@ -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

View File

@@ -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