Re: Table View/Array Troubles
Re: Table View/Array Troubles
- Subject: Re: Table View/Array Troubles
- From: Bob Warwick <email@hidden>
- Date: Thu, 12 Jun 2008 03:00:49 -0300
On 12-Jun-08, at 2:16 AM, Gabriel Shahbazian wrote:
Hi,
I've posted the source to an app I'm working on. If someone can take
a look and tell my why my tableview is not working with my array, it
would be of great help.
Source:
http://novisdesign.net/Labs/Alien Notes.zip
-Gabe
I found a couple problems in a quick look through your source:
Your NoteController init method looks like this:
- (id) init
{
[super init];
myNotes = [NSMutableArray array];
return self;
}
Calling the NSMutableArray convenience method array will return an
autoreleased object. You should do this instead:
- (id) init
{
[super init];
myNotes = [[NSMutableArray alloc] init];
return self;
}
Also, you populate your tableview by calling the title method of a
given note. Your title method looks like this:
- (NSString *) title
{
return [self title];
}
You're looking to access the title variable of the note instance, but
instead you just call the title method again. This creates a big ol'
neverending recursive call. You're wanting to do this:
- (NSString *) title
{
return title;
}
I'm also not too confident about how you're handling setting the title
and content of a note. Personally I'd use an NSMutableString for both
of those and set the content of the string when setTitle: or
setContent: is called.
-Bob Warwick
_______________________________________________
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