• 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
NSKeyValueCoding ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSKeyValueCoding ?


  • Subject: NSKeyValueCoding ?
  • From: Nico <email@hidden>
  • Date: Mon, 15 Jul 2002 09:15:08 +0200

Hi :)
I've got a problem using NSKeyValueCoding.

Let me explain :
I've got a class MyClass. In some other class, I need to create MyClass objects.
Therefore, in SomeOtherClass.h, I wrote :

/*
@class MyClass;
@interface SomeOtherClass : NSObject
{
NSMutableArray *objects;
MyClass *object1, *object2, *object3;
}
*/

Then in SomeOtherClass.m I try to store my objects into the NSMutableArray that way :

/*
int i;
object1 = [[MyClass alloc] init];
object2 = [[MyClass alloc] init];
object3 = [[MyClass alloc] init];

NSMutableArray *objects = [[NSMutableArray alloc] init];
for (i=1; i<=3; i++)
{
[objects addObject:[self valueForKey:[NSString stringWithFormat:@"object%d", i]]];
}
*/

Here is my problem : I'd like to be able to do the following code
object1 = [[MyClass alloc] init];
...
directly from -valueForKey: or something, cause I'll have thousands of objects, not three...

Unfortunately, I can't [self valueForKey:[NSString stringWithFormat:@"object%d", i]] = [[MyClass alloc] init] ;-)
My project uses this objects very often... so I can't go further until I've got a way to do this.

Any ideas ? Thanks !
Nico
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Piping shell scripts
  • Next by Date: Re: NSMenuItem separatorItem -- default spacing?
  • Previous by thread: Re: Piping shell scripts
  • Next by thread: Toolbaritem
  • Index(es):
    • Date
    • Thread