tags:

views:

322

answers:

1

Hello every one

I have a project in which need to put 2 UITableView on one UIView.

I know it need to set and can function below

-(NSString *) tableView:(UITableView *) tableView titleForHeaderInsection:(NSInteger)section

  • (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

    • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
    • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

but I do not know if these can process 2 tableviews (different from 2 sections)

Welcome any comment

Thanks interdev

+1  A: 

It looks like you're asking if one object (maybe a view controller?) can have two UITableViews both using it as their delegate. Yes, a view controller can be the delegate for multiple table views-- that's why all of those methods pass in a UITableView* as their first argument; it's for you to use to figure out which one is which. You should keep a couple instance variables (IBOutlets probably) in your view controller so you know which is which and you can act appropriately.

Cheers, Interdev.

quixoto