OC高效率52之在dealloc方法中只释放引用并解除监听

#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
相关文章
相关标签/搜索