• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: access multiple NSTextFields as an array?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: access multiple NSTextFields as an array?


  • Subject: Re: access multiple NSTextFields as an array?
  • From: Lee Ann Rucker <email@hidden>
  • Date: Mon, 20 Dec 2010 14:52:19 -0800
  • Acceptlanguage: en-US
  • Thread-topic: access multiple NSTextFields as an array?

On Dec 20, 2010, at 8:16 AM, Artemiy Pavlov wrote:

>>> 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! :-)
>
> Yes, I did this after sending this e-mail :-) Weird though, that it
> doesn't work straight away... Here is my code:
>
> int x;
> NSMutableArray *Array;

>
> for(x=1;x<=9;x++){
>     NSTextField *PatternRateLabel = etc. etc.
>     [Array addObject:PatternRateLabel];

Convention is that only classes start with capitals, so that you can tell the difference between calling a class method ([Array alloc]) and calling an instance method ([array addObject:]) at a glance. There are some methods that apply to both - a class is an object, after all - so the convention is useful.

> }
>
> [[Array objectAtIndex:0] setColor:...]
>
> However, if I have this last line, my view freezes... Maybe I do not
> create the array properly?
>
>
> All the best,
>
> Artemiy._______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >access multiple NSTextFields as an array? (From: Artemiy Pavlov <email@hidden>)
 >Re: access multiple NSTextFields as an array? (From: Siegfried <email@hidden>)
 >Re: access multiple NSTextFields as an array? (From: Artemiy Pavlov <email@hidden>)
 >Re: access multiple NSTextFields as an array? (From: Siegfried <email@hidden>)
 >Re: access multiple NSTextFields as an array? (From: Artemiy Pavlov <email@hidden>)

  • Prev by Date: Re: UIBezierPath: trying to create an array with CGPointMake
  • Next by Date: Re: Cocoa view gets sluggish over time
  • Previous by thread: Re: access multiple NSTextFields as an array?
  • Next by thread: Re: access multiple NSTextFields as an array?
  • Index(es):
    • Date
    • Thread