diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 67cdfd3920..3dc6ecffc0 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -301,8 +301,15 @@ NSInteger compareAddress(id l, id r, void * context) - (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; m_framework->MemoryWarning(); + [super didReceiveMemoryWarning]; +} + +- (void)viewDidUnload +{ + // to correctly release view on memory warnings + self.m_myPositionButton = nil; + [super viewDidUnload]; } - (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation @@ -354,6 +361,7 @@ NSInteger compareAddress(id l, id r, void * context) m_mapIsVisible = true; [self Invalidate]; [self.navigationController setNavigationBarHidden:YES animated:YES]; + [super viewWillAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated @@ -361,6 +369,7 @@ NSInteger compareAddress(id l, id r, void * context) m_mapIsVisible = false; m_framework->SetUpdatesEnabled(false); [self.navigationController setNavigationBarHidden:NO animated:YES]; + [super viewWillDisappear:animated]; } @end diff --git a/iphone/Maps/Classes/SearchVC.mm b/iphone/Maps/Classes/SearchVC.mm index a7bd4b1f31..7b2ec7085b 100644 --- a/iphone/Maps/Classes/SearchVC.mm +++ b/iphone/Maps/Classes/SearchVC.mm @@ -104,6 +104,11 @@ static void OnSearchResultCallback(search::Result const & res, int queryId) [m_locationManager stopUpdatingHeading]; [m_locationManager stopUpdatingLocation]; g_searchVC = nil; + // to correctly free memory + self.m_searchBar = nil; + self.m_table = nil; + m_results.clear(); + [super viewDidUnload]; } - (void)fixHeadingOrientation @@ -116,12 +121,14 @@ static void OnSearchResultCallback(search::Result const & res, int queryId) [self fixHeadingOrientation]; // show keyboard [m_searchBar becomeFirstResponder]; + [super viewWillAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { // hide keyboard immediately [m_searchBar resignFirstResponder]; + [super viewWillDisappear:animated]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation