Increment object property
Increment object property
- Subject: Increment object property
- From: email@hidden
- Date: Thu, 23 Oct 2008 09:10:03 +1300
Newbie question, Is it possible to have an object property that
increments everytime an object is instantiated?
@interface foo : NSObject {
NSString *name;
}
@property (copy,readwrite) NSString *name;
@end
#import "foo.h"
@implementation foo
- (id) init {
self = [super init];
if (self != nil) {
[self setName:@"untitled1"];
}
return self;
}
@synthesize name;
@end
I have an NSTableColumn that is bound to foo.name. An
NSArrayController looks after adding and removing the foo objects.
How can I make the name property increment from untitled1, untitled2,
untitled3... etc as the objects are added to the array?
Any help would be appreciated
Regards
Rob Carruthers
_______________________________________________
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