Re: NSTableView reloadData works just on init.
Re: NSTableView reloadData works just on init.
- Subject: Re: NSTableView reloadData works just on init.
- From: Nick Zitzmann <email@hidden>
- Date: Sun, 6 Dec 2009 22:07:36 -0700
On Dec 5, 2009, at 5:22 AM, Alberto Piu wrote:
>> shortcutsTable = [[NSTableView alloc] init];
There are several problems here:
1. The designated initializer of views is -initWithFrame:, not -init.
2. Even if you got that right, it would still not work, because you are resetting the pointer to the table view object to a brand new object. The table view object you probably want to address is freeze-dried in the nib, and will be connected once the nib is loaded, and so you shouldn't overwrite the pointer with something else unless you want to programmatically get rid of it and create a new one (if you're working on a dynamic interface, for instance).
3. Even if you corrected that, you can't send messages to objects connected by IB outlet in -init, because it's most likely that the nib has not been loaded yet unless you explicitly loaded it there. If you need to initialize things in the UI, then you should do that in -awakeFromNib instead.
HTH...
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:
This email sent to email@hidden