0

Hi guys

I'm currently building an app that will have a UITableView that will get it's data from a web service.

this is what I have:

First, i have a UIViewController that consume data from a web services that UIViewController has a UITableView to display data, this UIViewController works well.

Second, in each cell from the UITableView i have another UITableView showing information related to the cell pressed,

as you can see in this pic:

enter image description here

pls see the image

third, i made a custom UITableView Class for display that informacion, it needs information from the cell to get the data from web services.

My Question is:

How it is made to load data into that UITableView if I have already overwritten the necessary methods to load data into the UIViewController?

Pls Help me :C

KudoCC
  • 6,912
  • 1
  • 24
  • 53
  • The delegate and datasource of UITableView need not be the `UIViewController`, you can use any object which conforms to corresponding protocol. – KudoCC Sep 20 '15 at 02:54
  • i do that, but How do I pass data to the table if I am creating it from the stroyboard? – Jhon Lavigne Sep 20 '15 at 03:11

1 Answers1

0

To respect MVC design pattern, I would advise to set your UIViewController as delegate of your tableview inside your tableview cell. This can be done in your cellForRowAtIndexPath: like this:

cell.tableView.delegate = self;

This thread explains how you can handle 2 table views from within single view controller.

Community
  • 1
  • 1
Abhinav
  • 37,684
  • 43
  • 191
  • 309