Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView



Thanks about the memory leaks and about the allocating memory and stuff. And I thought that might be my problem but I am not sure how to actually use that method. The documentation was very vague in my opinion.

Jeremy
"For a long time it puzzled me how something so expensive, so leading edge, could be so useless, and then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match." - Bill Bryson



On Feb 28, 2008, at 7:49 PM, Nick Zitzmann wrote:


On Feb 28, 2008, at 5:41 PM, Jeremy wrote:

In awakeFromNib:

categoriesArray = [[[NSMutableArray alloc] init] retain];

Here you're over-retaining an NSArray. This won't do anything if you're using GC, but if you're not, then you've created a memory leak.


	NSString *string;
	string = [NSString init];

Never initialize a variable without allocating it memory first.

string = @"Main Category";

Here you've overwritten a variable you just (incorrectly) initialized. If all you want is a string, then you can do this:


NSString *string = @"Main Category";

[...]
The NSTableView is not being populated at all... No rows, and nothing else....


Did you remember to set the table view's data source?

Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSTableView (From: Jeremy <email@hidden>)
 >Re: NSTableView (From: "Hamish Allan" <email@hidden>)
 >Re: NSTableView (From: Jeremy <email@hidden>)
 >Re: NSTableView (From: Nick Zitzmann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.