Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

beesbane

macrumors newbie
Original poster
Oct 16, 2010
21
0
I have a segmented controller that switches between 2 tableviews. One is hidden, while the other is visible. Is it possible to set these up to load different sets of information within a single view?

My purpose is actually that one is set up with one particular view cell, and the other with another. But the information is the same.

Suggestions?
 
All your UITableView methods will pass in the table view that is asking for data. Based on which table view is passed in, you can do what you need to.

eg:
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  if(tableView == table1) {
    // Do stuff for table1 here
  } else if (tableView == table2) {
    // Do stuff for table2 here
  }
}

Just make sure table1 and table2 are declared with IBOutlet and connected in Interface Builder to your controller. Return a different cell for each Table.
 
I have a segmented controller that switches between 2 tableviews. One is hidden, while the other is visible. Is it possible to set these up to load different sets of information within a single view?

My purpose is actually that one is set up with one particular view cell, and the other with another. But the information is the same.

Suggestions?

If the only difference between UITableView1 and UITableView2 is the cell layout you can handle this with the cell identification.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.