开发者

Difference in NSMutableArray declaration

What is the diffe开发者_如何转开发rence between [NSMutableArray array] and [[NSMutableArray alloc] init]?


[NSMutableArray array] is equivalent to [[[NSMutableArray alloc] init] autorelease].


[NSMutableArray array]

returns an autoreleased array.

[[NSMutableArray alloc] init]

returns a retained array.

You don't own the autoreleased array, so you don't have to release it. You own the retained one (with alloc), so you have to release it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜