diff options
author | Justin R. Miller <incanus@codesorcery.net> | 2017-05-25 10:59:10 -0700 |
---|---|---|
committer | Justin R. Miller <incanus@codesorcery.net> | 2017-05-25 10:59:10 -0700 |
commit | 537355e16da43f38c3678b72d4bc265cf2883753 (patch) | |
tree | 7a77a5f29da63962dca933083f09fe26142d2ba5 /platform/ios/src | |
parent | fce7747da099519d8e29eff4befc5c205048492a (diff) | |
download | qtlocation-mapboxgl-upstream/9096-debug.tar.gz |
pairing debug codeupstream/9096-debug
Diffstat (limited to 'platform/ios/src')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 106 |
1 files changed, 63 insertions, 43 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index ed989459f5..89b6cddd24 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -656,21 +656,39 @@ public: _isWaitingForRedundantReachableNotification = NO; } +- (void)removeFromSuperview +{ + NSLog(@"removeFromSuperview"); + + [super removeFromSuperview]; +} + + - (void)dealloc { + NSLog(@"dealloc"); + [_reachability stopNotifier]; [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] removeObserver:self]; [_attributionButton removeObserver:self forKeyPath:@"hidden"]; - if (_isObservingTopLayoutGuide) { - [(NSObject *)self.viewControllerForLayoutGuides.topLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; - } - - if (_isObservingBottomLayoutGuide) { - [(NSObject *)self.viewControllerForLayoutGuides.bottomLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; - } +// if (_isObservingTopLayoutGuide) { +// [(NSObject *)self.viewControllerForLayoutGuides.topLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; +// } else { +// NSLog(@"not observing top!"); +// } +// +// if (_isObservingBottomLayoutGuide) { +// [(NSObject *)self.viewControllerForLayoutGuides.bottomLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; +// } else { +// NSLog(@"not observing bottom!"); +// } + +// NSLog(@"observing: %@", self.ob + + // Removing the annotations unregisters any outstanding KVO observers. NSArray *annotations = self.annotations; @@ -791,21 +809,21 @@ public: UIViewController *viewController = self.viewControllerForLayoutGuides; BOOL useLayoutGuides = viewController.view && viewController.automaticallyAdjustsScrollViewInsets; - if (useLayoutGuides && viewController.topLayoutGuide && !_isObservingTopLayoutGuide) { - [(NSObject *)viewController.topLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:(void *)&MGLLayoutGuidesUpdatedContext]; - _isObservingTopLayoutGuide = YES; - } else if (!useLayoutGuides && _isObservingTopLayoutGuide) { - [(NSObject *)viewController.topLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; - _isObservingTopLayoutGuide = NO; - } - - if (useLayoutGuides && viewController.bottomLayoutGuide && !_isObservingBottomLayoutGuide) { - [(NSObject *)viewController.bottomLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:(void *)&MGLLayoutGuidesUpdatedContext]; - _isObservingBottomLayoutGuide = YES; - } else if (!useLayoutGuides && _isObservingBottomLayoutGuide) { - [(NSObject *)viewController.bottomLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; - _isObservingBottomLayoutGuide = NO; - } +// if (useLayoutGuides && viewController.topLayoutGuide && !_isObservingTopLayoutGuide) { +// [(NSObject *)viewController.topLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:(void *)&MGLLayoutGuidesUpdatedContext]; +// _isObservingTopLayoutGuide = YES; +// } else if (!useLayoutGuides && _isObservingTopLayoutGuide) { +// [(NSObject *)viewController.topLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; +// _isObservingTopLayoutGuide = NO; +// } +// +// if (useLayoutGuides && viewController.bottomLayoutGuide && !_isObservingBottomLayoutGuide) { +// [(NSObject *)viewController.bottomLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:(void *)&MGLLayoutGuidesUpdatedContext]; +// _isObservingBottomLayoutGuide = YES; +// } else if (!useLayoutGuides && _isObservingBottomLayoutGuide) { +// [(NSObject *)viewController.bottomLayoutGuide removeObserver:self forKeyPath:@"bounds" context:(void *)&MGLLayoutGuidesUpdatedContext]; +// _isObservingBottomLayoutGuide = NO; +// } } - (BOOL)isOpaque @@ -835,6 +853,8 @@ public: // This gets called when the view dimension changes, e.g. because the device is being rotated. - (void)layoutSubviews { + NSLog(@"layoutSubviews"); + [super layoutSubviews]; [self adjustContentInset]; @@ -933,27 +953,27 @@ public: UIViewController *viewController = self.viewControllerForLayoutGuides; BOOL useLayoutGuides = viewController.view && viewController.automaticallyAdjustsScrollViewInsets; - if (!_isObservingTopLayoutGuide && useLayoutGuides && viewController.topLayoutGuide) - { - [(NSObject *)viewController.topLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:MGLLayoutGuidesUpdatedContext]; - _isObservingTopLayoutGuide = YES; - } - else if (!useLayoutGuides && _isObservingTopLayoutGuide) - { - [(NSObject *)viewController.topLayoutGuide removeObserver:self forKeyPath:@"bounds" context:MGLLayoutGuidesUpdatedContext]; - _isObservingTopLayoutGuide = NO; - } - - if (!_isObservingBottomLayoutGuide && useLayoutGuides && viewController.bottomLayoutGuide) - { - [(NSObject *)viewController.bottomLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:MGLLayoutGuidesUpdatedContext]; - _isObservingBottomLayoutGuide = YES; - } - else if (!useLayoutGuides && _isObservingBottomLayoutGuide) - { - [(NSObject *)viewController.bottomLayoutGuide removeObserver:self forKeyPath:@"bounds" context:MGLLayoutGuidesUpdatedContext]; - _isObservingBottomLayoutGuide = NO; - } +// if (!_isObservingTopLayoutGuide && useLayoutGuides && viewController.topLayoutGuide) +// { +// [(NSObject *)viewController.topLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:MGLLayoutGuidesUpdatedContext]; +// _isObservingTopLayoutGuide = YES; +// } +// else if (!useLayoutGuides && _isObservingTopLayoutGuide) +// { +// [(NSObject *)viewController.topLayoutGuide removeObserver:self forKeyPath:@"bounds" context:MGLLayoutGuidesUpdatedContext]; +// _isObservingTopLayoutGuide = NO; +// } +// +// if (!_isObservingBottomLayoutGuide && useLayoutGuides && viewController.bottomLayoutGuide) +// { +// [(NSObject *)viewController.bottomLayoutGuide addObserver:self forKeyPath:@"bounds" options:0 context:MGLLayoutGuidesUpdatedContext]; +// _isObservingBottomLayoutGuide = YES; +// } +// else if (!useLayoutGuides && _isObservingBottomLayoutGuide) +// { +// [(NSObject *)viewController.bottomLayoutGuide removeObserver:self forKeyPath:@"bounds" context:MGLLayoutGuidesUpdatedContext]; +// _isObservingBottomLayoutGuide = NO; +// } } - (void)setContentInset:(UIEdgeInsets)contentInset |