Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
很久以前写过,现在找不到了。
如何为使用相同语法的类创建创建者函数[NSArray array];?
[NSArray array];
IE
+ (id)object;
代替...
- (id)initWithBlah...
谢谢
它被称为构造函数,典型的实现可能是
+ (NSArray *)array { return [[[self alloc] init] autorelease]; }