我不明白为什么要写这些代码
icons = [[NSArray alloc] initWithObjects:
@"appointment",
@"work",
@"anniversary",
@"me",
nil];
应用程序崩溃了。但后来我用这些代码代替了
icons = [NSArray alloc] arrayWithObjects:
@"appointment",
@"work",
@"anniversary",
@"me",
nil];
而且应用程序没有崩溃。 但是这些方法之间的影响是一样的! 我不知道为什么?你能帮帮我吗?
最佳答案
initWithObjects 方法意味着您必须在不需要时释放数组对象,因为这是实例方法,更多详细信息click :
arrayWithObjects 方法意味着您无需在不需要时释放数组对象,因为这是类方法,更多详情 click :
如果你不清楚要点,请回复我..
关于iphone - alloc initWithObjects 与 arrayWithObject,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14932658/