要实例化我一直使用的 NSArrays:
NSArray *a = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
但最近我看到一个例子,通过分配 NSArray 对象,NSArrays 像其他所有对象一样被实例化:
NSArray *a = [[NSArray alloc] initWithObjects:@"one", @"two", @"three", nil];
实例化数组对象的两种方式有区别吗?
要实例化我一直使用的 NSArrays:
NSArray *a = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
但最近我看到一个例子,通过分配 NSArray 对象,NSArrays 像其他所有对象一样被实例化:
NSArray *a = [[NSArray alloc] initWithObjects:@"one", @"two", @"three", nil];
实例化数组对象的两种方式有区别吗?