From 0f14f40afa74bb94024f704f7704165c5a95d1de Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Mon, 21 Nov 2016 10:20:17 +0300 Subject: [PATCH] [notifications] [ios] Added missing NSNotificationCenter removeObserver calls. --- .../CustomViews/MapViewControls/APIBar/MWMAPIBar.mm | 2 +- iphone/Maps/Classes/MWMTextView.mm | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm index 375ff5042a..51d8f85dbf 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm @@ -101,7 +101,7 @@ static NSString * const kKeyPath = @"subviews"; } else { - [self.rootView.superview removeObserver:self forKeyPath:kKeyPath]; + [controller.view removeObserver:self forKeyPath:kKeyPath]; [self.rootView removeFromSuperview]; [self.timer invalidate]; } diff --git a/iphone/Maps/Classes/MWMTextView.mm b/iphone/Maps/Classes/MWMTextView.mm index 253c35b19c..dc113c4db6 100644 --- a/iphone/Maps/Classes/MWMTextView.mm +++ b/iphone/Maps/Classes/MWMTextView.mm @@ -16,12 +16,16 @@ [self updatePlaceholderVisibility]; - NSNotificationCenter * defaultCenter = [NSNotificationCenter defaultCenter]; - [defaultCenter addObserver:self selector:@selector(textDidChange:) + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange:) name:UITextViewTextDidChangeNotification object:self]; self.clipsToBounds = YES; } +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self name:UITextViewTextDidChangeNotification object:nil]; +} + - (UILabel *)placeholderView { if (!_placeholderView)