Attach compass gesture recognizer to compass view

Fixes #3099.
This commit is contained in:
Minh Nguyễn
2015-11-24 12:11:10 -08:00
parent 6d4e86f41d
commit 8ba6f80c1b
2 changed files with 4 additions and 1 deletions

View File

@@ -23,6 +23,8 @@ Known issues:
## iOS master
- Fixed an issue preventing the compass from responding to taps after the compass is moved programmatically. ([#3116](https://github.com/mapbox/mapbox-gl-native/pull/3116))
## iOS 3.0.0
- If you install this SDK via CocoaPods, CocoaPods version 0.38.0 or above is required. ([#2132](https://github.com/mapbox/mapbox-gl-native/pull/2132))

View File

@@ -292,10 +292,11 @@ std::chrono::steady_clock::duration durationInSeconds(float duration)
_compassView.accessibilityLabel = @"Compass";
_compassView.frame = CGRectMake(0, 0, _compassView.image.size.width, _compassView.image.size.height);
_compassView.alpha = 0;
_compassView.userInteractionEnabled = YES;
[_compassView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCompassTapGesture:)]];
UIView *container = [[UIView alloc] initWithFrame:CGRectZero];
[container addSubview:_compassView];
container.translatesAutoresizingMaskIntoConstraints = NO;
[container addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCompassTapGesture:)]];
[self addSubview:container];
// setup interaction