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: Mon, 7 Dec 2009 10:28:13 -0700
On Dec 7, 2009, at 2:57 AM, Alberto Piu wrote:
> 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?
That's correct. If you made the connection to the outlet in IB, then the outlet pointer will point to the table view in the nib (you did place a table view in the nib, and connect the outlet, right?) once the nib is loaded.
> 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.
That's to be expected. When you init an object with IB outlets, the outlets are nil. You have to load the nib, and then, if you made a connection between the table view and the outlet in the nib, the outlet to the table view will be initialized and ready to take messages. Until then, the outlet will be nil, and sending messages to nil is a no-op.
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