Here is my code:
@interface YQViewController ()
@property (nonatomic, strong) UILabel *lb1;
@end
@implementation YQViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.title = @"title";
self.lb1 = [[UILabel alloc]init];
NSLog(@"retain count is %ld", CFGetRetainCount((__bridge CFTypeRef)self.lb1));
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
As you can see, I send +alloc
and -init
to self.lb1
, I think the retain count of self.lb1
should equal 1, but the console output is 2. Can someone tell me the reason.(ARC enable, xcode 5, OSX 10.9.1, iOS 7 simulator).