one alloc, retainCount == 2

前端 未结 5 1764
情话喂你
情话喂你 2020-12-19 20:12

I have a following code:

NSLog(@\"%d\", [chart retainCount]);

self.chart = [[BNPieChart alloc] initWithFrame:self.view.frame];
NSLog(@\"%d\", [chart retainC         


        
5条回答
  •  忘掉有多难
    2020-12-19 20:37

    chart is probably a retained property, that's why you have 2 retainCount. That's why you can see some declaration like that :

    BNPieChart *aChart = [[BNPieChart alloc] initWithFrame:self.view.frame];
    self.chart = aChart;
    [aChart release];
    

提交回复
热议问题