Reputation: 65
When I use this code, Xcode gives me an error:
NSArray *buttonsFiles = [NSArray arrayWithObject:@"button_plus.png",@"button_minus.png",@"button_multiple.png",@"button_div.png",@"button_eq.png",@"button_percent.png",@"button_sqrt.png",@"button_back.png",@"button_pointer.png",@"button_c.png",@"button_0.png",@"button_1.png",@"button_2.png",@"button_3.png",@"button_4.png",@"button_5.png",@"button_6.png",@"button_7.png",@"button_8.png",@"button_9.png",nil];
Should I use this instead to avoid the error?
NSString *myfile1 = [@"button_plus.png"];
NSString *myfile2 = [@"button_minus.png"];
...
NSString *myfile20 = [@"button_9.png"];
NSArray* myArray = [NSArray arrayWithObjects:myfile1, myfile2... myfile20r, nil];
Upvotes: 2
Views: 1252
Reputation: 2703
The method you need is [NSArray arrayWithObjects:]
, not [NSArray arrayWithObject:]
Note the plural Objects.
Upvotes: 5