码迷,mamicode.com
首页 > 其他好文 > 详细

Dealloc weak nil

时间:2016-05-30 21:29:49      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface B : NSObject
@end
@implementation B
- (void)dealloc
{
    NSLog(@"in dealloc");
}
@end

@interface A  : NSObject
@property(nonatomic, weak)id referObj;
- (void)foo;

@end

@implementation A
- (void)foo
{
    B*b = [B new];
    self.referObj = b;
    NSLog(@"%@",b);
}
@end
int main(int argc, char * argv[]) {
    @autoreleasepool {
        A*a = [A new];
        [a foo];
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

  

技术分享

 

Dealloc weak nil

标签:

原文地址:http://www.cnblogs.com/wxm5558/p/5543743.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!