summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2018-05-23 23:44:41 -0400
committerJulian Rex <julian.rex@mapbox.com>2018-05-24 01:05:18 -0400
commit0b28aef1eb8529aa9f2751a205ba14512c1552da (patch)
treedab94fa02a4e2680ada97c168ac5809c99c163db
parent4dc0f4eb64f710f3b4229cddab375f1b1aa41f3e (diff)
downloadqtlocation-mapboxgl-upstream/jrex-scalebar.tar.gz
Removed notification handling (not required for iOS).upstream/jrex-scalebar
Added change log note.
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/app/MBXViewController.m14
-rw-r--r--platform/ios/src/MGLScaleBar.mm15
3 files changed, 8 insertions, 22 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 7c8181a65a..1cf5bf1e66 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -19,6 +19,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Improved application launch performance.
* Fixed an issue preventing nested key path expressions get parsed accordingly to the spec. ([#11959](https://github.com/mapbox/mapbox-gl-native/pull/11959))
* Added custom `-hitTest:withEvent:` to `MGLSMCalloutView` to avoid registering taps in transparent areas of the standard annotation callout. ([#11939](https://github.com/mapbox/mapbox-gl-native/pull/11939))
+* Improved performance and memory impact of `MGLScaleBar`. ([#11921](https://github.com/mapbox/mapbox-gl-native/pull/11921))
## 4.0.1 - May 14, 2018
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 5f6e563a6c..a1479b4538 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -152,8 +152,8 @@ CLLocationCoordinate2D randomWorldCoordinate() {
// Now create a world coord
CLLocationDegrees heading = drand48()*360.0;
- CLLocationDistance dist = drand48()*radius;
- CLLocationCoordinate2D newLocation = coordinateCentered(coordinate, heading, dist);
+ CLLocationDistance distance = drand48()*radius;
+ CLLocationCoordinate2D newLocation = coordinateCentered(coordinate, heading, distance);
return newLocation;
}
@@ -1753,8 +1753,8 @@ CLLocationCoordinate2D randomWorldCoordinate() {
for (NSInteger i = 0; i<numAnnotations; i++) {
CLLocationDegrees heading = drand48()*360.0;
- CLLocationDistance dist = drand48()*radius;
- CLLocationCoordinate2D newLocation = coordinateCentered(coordinate, heading, dist);
+ CLLocationDistance distance = drand48()*radius;
+ CLLocationCoordinate2D newLocation = coordinateCentered(coordinate, heading, distance);
MBXDroppedPinAnnotation *annotation = [[MBXDroppedPinAnnotation alloc] init];
annotation.coordinate = newLocation;
@@ -1769,10 +1769,10 @@ CLLocationCoordinate2D randomWorldCoordinate() {
[self.mapView removeAnnotations:self.mapView.annotations];
[self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(31, -100) zoomLevel:3 animated:NO];
- [self _randomWorldTourInternal];
+ [self randomWorldTourInternal];
}
-- (void)_randomWorldTourInternal {
+- (void)randomWorldTourInternal {
self.randomWalk = YES;
@@ -1809,7 +1809,7 @@ CLLocationCoordinate2D randomWorldCoordinate() {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
MBXViewController *strongSelf = weakSelf;
if (strongSelf.randomWalk) {
- [strongSelf _randomWorldTourInternal];
+ [strongSelf randomWorldTourInternal];
}
});
}];
diff --git a/platform/ios/src/MGLScaleBar.mm b/platform/ios/src/MGLScaleBar.mm
index 3b13ee9f57..d69fb3e852 100644
--- a/platform/ios/src/MGLScaleBar.mm
+++ b/platform/ios/src/MGLScaleBar.mm
@@ -122,10 +122,6 @@ static const CGFloat MGLFeetPerMeter = 3.28084;
@implementation MGLScaleBar
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSCurrentLocaleDidChangeNotification object:nil];
-}
-
- (instancetype)initWithCoder:(NSCoder *)decoder {
if (self = [super initWithCoder:decoder]) {
[self commonInit];
@@ -183,19 +179,8 @@ static const CGFloat MGLFeetPerMeter = 3.28084;
// Zero is a special case (no formatting)
[self addZeroLabel];
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(currentLocaleDidChange:)
- name:NSCurrentLocaleDidChangeNotification
- object:nil];
}
-- (void)currentLocaleDidChange:(NSNotification*)notification {
- // Clear the cache, so labels should be rebuilt.
- [self.labelImageCache removeAllObjects];
- [self addZeroLabel];
-};
-
#pragma mark - Dimensions
- (CGSize)intrinsicContentSize {