如何创建相同对象的多个实例并以有效的方式在数组中调用它们?我知道 for 循环,但不熟悉 Objective-C 语法。这是我目前拥有的:
视图控制器.h
NSArray *wArray;
NSInteger w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28;
@property NSArray *wArray;
@property NSInteger w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28;
@end
视图控制器.m
@synthesize w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28, wArray;
wArray = [NSArray arrayWithObjects: w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28, nil];
提前致谢!