iOS program to use multiple UITableView in a single UIViewController

后端 未结 5 588
庸人自扰
庸人自扰 2021-01-15 09:55

I am trying to implement 3 tables in a single segue in a storyboard. When one table is selected it will unhidden a view with another table and likewise one more. The followi

5条回答
  •  情话喂你
    2021-01-15 10:05

    You have the tableview reference in each of your delegate methods right? You can find out which tableview you are currently walking through based on that..

    Assuming..

    IBOutlet UITableView *tableView1;
    IBOutlet UITableView *tableView1;
    IBOutlet UITableView *tableView1;
    

    Ex:

    -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
    {
        if(tableView == tableView1)
          return 1;
        if(tableView == tableView2)
          return 5;
        return 10;
    }
    

    You can do the same for the other delegate methods.. I hope I understood your question correctly..

提交回复
热议问题