#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//不应该自己调用dealloc方法,运行期系统会在适当的时候调用它。
//在dealloc方法做什么:
/* 1.清空所有对象
2.移除通知
3.调用dealloc方法时,对象已处于正在回收的状态了,不应该再调用其他方法。
*/
}
//例
-(void)dealloc{
//CFRelease(corefoundationobject)
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
转载于:https://my.oschina.net/u/2319073/blog/631799