Page 200/201: Connecting the table view's data source


#1

Hey,

On page 200 & 201 the book says:

“Finally, Control-Shift-click on the table view and select the NSTableView from the list. Then Control-drag from the table view to File’s Owner and select dataSource from the connection pop-up.”

So I am able to select the NSTableView just fine as with one of the previous connections, however I am not able to get File’s Owner to behave as a place to connect it to, other elements in the Document Outline are selectable but not appropriate.

I also know you can right click an item for it’s available outlets and actions, I did this and there is no dataSource connection point. This made me think I must have missed out a protocol in the header of BNRDocument. I had, I missed out , I went back and added it, saved it and still couldn’t get it to allow me to connect.

I have since tried following all the steps from scratch and I still cannot get this to work. I am using Mac OS X Lion 10.7.4 and Xcode 4.3.3. My header file looks like this:

#import <Cocoa/Cocoa.h>

@interface BNRDocument : NSDocument <NSTableViewDataSource>
{
	NSMutableArray *todoItems;
	IBOutlet NSTableView *itemTableView;
}

- (IBAction)createNewItem:(id)sender;

@end

What should I do, I really can’t see why this isn’t working as I have created a whole new project from scratch and it’s still not working.


#2

I managed to fix it, looking at the documentation I realised suddenly that although I intended to Control-Shift-click and select the NSTableView, I actually selected NSScrollView.

Thanks anyways!