2 UITableViews in one UIView

后端 未结 5 1367
一生所求
一生所求 2020-12-02 23:23

I have a UIView that will need to display two UITableViews, but they are never shown together, by using a SegementedBar you can toggle one or the o

5条回答
  •  萌比男神i
    2020-12-02 23:53

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        ...
    
        if (tableView.tag == 1) {
    
            ...
    
        } else { // tableView == self.secondTableView
    
            ...
        }
    }
    

    tag could be assigned from the .xib. so no need to have UITableVeiw variable in .h file. Two table view in .xib needed

提交回复
热议问题