如何在UIViewController中使用2 UITableView? [英] How to use 2 UITableView in a UIViewController?

查看:89
本文介绍了如何在UIViewController中使用2 UITableView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Plz指导我如何在UIViewController&中使用2 UItableView(或更多)管理他们的$
numberOfRowsInSection,......&其他方法。

任何想法?


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

推荐答案

假设你的实际问题在于分配与UITableViewDelegate相同的对象:

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

UITableViewDelegete 方法将UITableView实例传递给它。您只需要过滤掉需要操作的tableview。例如:

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) {
        // <do whatever on first table view>...
    } else if (tableView == yourSecondTableView) {
        // <do whatever on second table view>...
    }
}

这篇关于如何在UIViewController中使用2 UITableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆