viewDidUnload不允許在ios6上,所以如何兼容性viewDidUnload和didReceiveMemoryWarning來調用。 我需要viewDidUnload和didReceiveMemoryWarning兼容性
- (void)viewDidUnload{
self.listArr=nil;
[super viewDidUnload];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
float sysVer =[[[UIDevice currentDevice] systemVersion] floatValue];
if (sysVer>= 6.0f){
if([self isViewLoaded] && !self.view.window){
self.listArr=nil;
self.view = nil;
}
}
NSLog(@" BrowseComment didReceiveMemoryWarning");
}
或僅在iOS5的使用後續的代碼和iOS6的
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
if([self isViewLoaded] && !self.view.window){
self.listArr=nil;
self.view = nil;
}
NSLog(@" BrowseComment didReceiveMemoryWarning");
}
請參閱本[http://stackoverflow.com/questions/12674268/ios-6-viewdidunload-migrate-to-didreceivememorywarning ] [1] [1]:http://stackoverflow.com/questions/12674268/ios-6-viewdidunload-migrate-to-didreceivememorywarning – 2013-02-19 11:44:24