--- On Wed, 10/22/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Newbie question, Is it possible to have an object property > that > increments everytime an object is instantiated?
Simplest solution: Just increment a static int and insert that into your string. Fancy it up as appropriate to your situation. @interface Foo : NSObject { NSString *name; } @property (copy,readwrite) NSString *name; @end #import "foo.h" @implementation Foo @synthesize name; - (id) init { static unsigned documentCount = 1; self = [super init]; if (self != nil) { self.name = [NSString stringWithFormat:@"untitled%u", count++]; } return self; } @end Cheers, Chuck _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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]