Re: NSTableView reloadData works just on init. (Alberto Piu)
Re: NSTableView reloadData works just on init. (Alberto Piu)
- Subject: Re: NSTableView reloadData works just on init. (Alberto Piu)
- From: Alberto Piu <email@hidden>
- Date: Mon, 7 Dec 2009 10:57:56 +0100
Thank you for your reply.
I understand more or less what are the problems, but I don't really
know what to change to make it work.
You said that this line:
shortcutsTable = [[NSTableView alloc] init];
should be
shortcutsTable = [[NSTableView alloc] initWithFrame:etc];
but although this is correct it resets the pointer to a brand new
object, so I have to remove this line?
I have an AppDelegate controller. Inside awakeFromNib there is:
id shortcuts = [[ShortcutsTableController alloc] init];
[shortcuts addLine:@"blabla" :@"bla"];
this simply does nothing. He goes correctly to the addLine method but
reloadData simply does not work.
--
Please don't get my words wrong. I REALLY appreciate your help, but
I'm a "bit" unskilled and I need more precision.
Again, thanks for reply.
Regards,
—Albé
Il giorno 07/dic/2009, alle ore 06.07, Nick Zitzmann ha scritto:
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