Cocoa Touch - UITableView in View

Hello,

Problem:

I have a basic view that is already associated with the xib file, the appdelegate class, and the controller class.

Now, having opened my xib file in the interface builder, I am adding a UITableView.

Then, in my controller class, I create IBoutlet code to use it, say: tableView.


Questions:

1) Where can I go from here to populate this table and then implement event handling methods?

2) What is the best way to create / implement a UITableView and then add it to the parent view?

Thank you very much. Johann T.

ps: I looked at a couple of tutorials and no one shows how to connect them to the parent view.

+4
source share
1 answer

1) Where can I go from here to populate this table and then implement event handling methods?

A UITableView gets its data from a UITableViewDataSource , and it allows the UITableViewDelegate handle events related to. Typically, your controller class will implement both of these protocols, i.e.:

 @interface MyViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> 

Then in Interface Builder you can make an association from the controller class with the dataSource and delegate properties of the UITableView object.

2) What is the best way to create / implement a UITableView and then add it to the parent view?

The easiest way is with Interface Builder; drag and drop the UITableView directly into the parent view.

+4
source

All Articles