一个文件中有两个UITableView [英] Two UITableViews in one file

查看:83
本文介绍了一个文件中有两个UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用相同的控制器文件使用两个UITableView?如果是这样,你如何区分这两者?如果没有,那么你将如何控制它们?

Is it possible to have two UITableViews using the same controller file? If so how do you differentiate the two? If not then how would you control them?

推荐答案

肯定是。为每个tableview创建一个实例变量。

Yes definately. Create two instance variables one for each tableview.

表视图委托方法包括一个指向表视图的指针,在方法中调用它们,例如,

The table view delegate methods include a pointer to the table view calling them in the method do something like,

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    if(tableView != [self tableView1]){
      //do stuff
    }
    //handle tableView2
    else{

    }

这篇关于一个文件中有两个UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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