我的ViewController
中有3个tableView
,可不可以实现单独使用UITableViewDelegate
方法?比如,可以分别对每个UITableView
使用cellForRowAtIndexPath
方法,但是不知道对每个tableView
单独用numberOfRowsInSection
或者numberOfSectionsInTableView
有什么不同?可以实现吗?
在使用批量tableview时使用delegates
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- Kill_it 2013-02-21 06:08关注
可以啊
:D设置3个
UITableView
变量,放在你的 ViewController.h 文件中:在你的 ViewController : UIViewController
{ UITableView* tableView1; UITableView* tableView2; UITableView* tableView3; }
并且在你的 ViewController.m 中:
-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section { if (tableView == tableView1) { //Your code } if (tableView == tableView2) { //Your code } if (tableView == tableView3) { //Your code } }
解决 无用评论 打赏 举报
悬赏问题
- ¥15 自动转发微信群信息到另外一个微信群
- ¥15 outlook无法配置成功
- ¥30 这是哪个作者做的宝宝起名网站
- ¥60 版本过低apk如何修改可以兼容新的安卓系统
- ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
- ¥50 有数据,怎么建立模型求影响全要素生产率的因素
- ¥50 有数据,怎么用matlab求全要素生产率
- ¥15 TI的insta-spin例程
- ¥15 完成下列问题完成下列问题
- ¥15 C#算法问题, 不知道怎么处理这个数据的转换