• 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
Increment object property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Increment object property
      • From: Charles Steinman <email@hidden>
    • Re: Increment object property
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Memory Leaks in CocoaEcho Sample
  • Next by Date: Re: Memory Leaks in CocoaEcho Sample
  • Previous by thread: Re: LSUIElement application and coming to the front
  • Next by thread: Re: Increment object property
  • Index(es):
    • Date
    • Thread