开发者

Calling UIViews's subviews property increments subview retain count by 1?

I have this code:

UIView *superView = [[UIView alloc] init];
UIView *subView = [[UIView alloc] init];
[superView addSubview:subView];
[subView release];
NSLog(@"retain before %i", [subView retainCount]);//prints 1
int i = superView.subviews.count ;
NSLog(@"retain after %i", [subView retai开发者_StackOverflow中文版nCount]);//prints 2
i = superView.subviews.count ;
NSLog(@"retain odd %i", [subView retainCount]);//keeps printing 2

Is this an "expected" behavior ?. If so, what is the underlying logic ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜