How to use 2 UITableView in a UIViewController?

后端 未结 5 734
刺人心
刺人心 2021-01-14 01:33


Plz guide that how can i use 2 UItableView(or more) in a UIViewController & manage their
numberOfRowsInSection,......& other methods.
Any ideas for that

5条回答
  •  清酒与你
    2021-01-14 02:18

    Assuming that your actual problem lies in assigning the same object as UITableViewDelegate:

    UITableViewDelegete methods pass the UITableView instance to it. You just need to filter out which tableview you need to operate on. For example:

    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
        if (tableView == yourFirstTableView) {
            // ...
        } else if (tableView == yourSecondTableView) {
            // ...
        }
    }
    

提交回复
热议问题