[ios] Correctly release Outlets and add missing calls to [super …] for some overloads

This commit is contained in:
Alex Zolotarev 2011-10-17 01:49:37 +03:00 committed by Alex Zolotarev
parent 4fb4a101bb
commit a41edbd6b9
2 changed files with 17 additions and 1 deletions

View file

@ -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

View file

@ -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