PDA

View Full Version : Don't want to load a TableView Yet !!! [HELP]




Fritzables
Jun 18, 2011, 04:21 AM
Hi All,

I am trying to develop an application that contains a TableView which ultimately will be data from selected Arrays.

I am in the early stages of the program so far from complete and testing as I go - only had the Mac 4 weeks now (and loving it).

I use XCode and Cocoa Framework.

I have created the App that contains the default AppDelegate.h and .m which I have not touched at all.

I have created a Class to act as the main class and in IB I created a controller that looks at this class. This class defines all my window objects like buttons text inputs and a NSTableView, the class also houses a NSPopUpButton which will be used to control what data ends up displaying in the TableView as the enduser select various options.

Each end user selection will bring another class into being. In my current work the new class holds the Array and the definition for the TableView:

IBOutlet NSTableView *inputView;

I have also included a new controller for the new class and I have linked the Array and the TableView to this controller....

Anyway.... when I run the application to see how things are progressing, the TableView loads with the data I had placed in the Array during the class 'init' method.

I don't want the data to be loaded into the view until such time as the user selects an option from the PopUpButton.

I suspect I am still having issues understanding the controller and I use it to control the objects that need it.

To assist you to understand what I am on about I have attached my work to-date so someone can take a gander and see what I have or am doing wrong.

Pete



Sydde
Jun 19, 2011, 09:42 AM
The NSTableView has to get its content from the datasource. Apple did it this way for flexibility: so that a single table could conceivably be reused by simply switching its datasource object.

I would guess you have linked the datasource in Interface Builder, which is why the table tries to load. If you delete that entry in the nib, the table will not load until your program gives it a datasource to read from.

Fritzables
Jun 20, 2011, 02:18 AM
G'Day Sydde,

Thanks for that.... removed the link in IB and bought everything into one class.

Worked like a dream.

Now I have pushed my arrays into a separate Class - now just need to become familiar on how to pass or should I say return the data.

I'll get there....

Pete