Two UITableView in the same view

前端 未结 6 781
Happy的楠姐
Happy的楠姐 2020-12-05 15:16

I want to know if it\'s allowed to use Multiple UItableView in the same View (i don\'t see any thing in the Apple\'s Human Interface Guidelines) and if it\'s OK

6条回答
  •  执念已碎
    2020-12-05 15:41

    You can have multiple table views in a single view. Add tags to each table view and with use of tableview.tag you can load data into tableviews separately.

    Example:

     - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        {
         if (tableView.tag == x) {
            //code to load table view with tag value x
    
            }
            else{
            //code to load second table
            }
            return cell;
    
        }
    

提交回复
热议问题