On 20/12/2010, at 14:01, Artemiy Pavlov wrote:
>> Just create a NSMutableArray before the loop:
>>
>> NSMutableArray *array = [NSMutableArray arrayWithCapacity:16];
>>
>> And then add each field to the array right in the loop
>>
>> for (…) {
>> …
>> [array addObject:textField];
>> }
>
> Great, thanks a lot!
You're welcome :-)
> Can I then access each element via array[0], array[1] etc.? I.e. will
> [array[0] setColor:...] work?
No! This is not a C array, it's an object. Use -objectAtIndex instead I.e.
[[array objectAtIndex:0] setColor:…]
Check documentation for NSArray and NSMutableArray for more info, it's your
friend! :-)_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]