new2ios
new2ios

Reputation: 1350

How properly add UITableView with prototyped cells in UIView in Interface builder?

I try to make UIViewController (VC) with UITableView (TV) inside it with custom prototyped cells (PC). I use mainly Interface Builder. I do follwing steps:

  1. I created VC and I add TV to it in the Storyboard.

  2. I set VC class as delegate to the TV using UITableViewDelegate.

  3. I created PC and created custom class for it. I set that class to be custom class for PC

  4. I added TV as outlet to VC class code.

  5. I added all controls from PC as outlets to PC custom class.

  6. I configured identifier for PC. I added all methods of TV to VC class.

When I run my App the methods for TV never start and the TV is empty. I am sure that I missed something but I can not figure what. Any ideas?

Upvotes: 1

Views: 74

Answers (1)

Daniyar
Daniyar

Reputation: 3003

You need to implement methods of UITableViewDataSource as well as UITableViewDelegate.

-(NSInteger)numberOfSectionInTableView:(UITableView *)tableView;
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)secion;
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath)indexPath;

Upvotes: 1

Related Questions