Joran
Joran

Reputation: 69

Cocoa tableview overview

I am really new to Cocoa and I am working on a test app with a NSMutableArray with NSDictionary objects as childs. Eventually I want to be able to add/edit/display the array using a tableview.

I have a class which on init creates the NSMutableArray and has methods to add objects to the array. Should the class have the: numberOfRowsInTableView and tableView methods? Or should I separate them from my class?

Upvotes: 0

Views: 221

Answers (1)

tlunter
tlunter

Reputation: 724

You need to put the numberOfRowsInTableView and other tableView datasource and delegate methods in the class that you have set as the datasource and delegate. You can put them in your main class for ease of passing variables, or if you know how to get variables from other classes, feel free to make a (Initials)TableView class to hold the delegate and datasource methods.

Upvotes: 1

Related Questions