您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页tableview的一个疑问

tableview的一个疑问

来源:化拓教育网

情况是酱紫滴,偶做了个首页,很简单,一个tableview搞定,也没啥特殊的,两个section而已,section里的数据源不一样,model不一致,于是我这么写的:

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

if (section == 0) {

return self.lawyers.lawyerList.count;

}else {

return self.orders.list.count;

}

}

没啥大疑问吧!错了,数据展示OK,但是丫的table就是拖不动了,head点击正常,tabbar点击正常,可是为嘛呢?

算了写个死的试试,把其中一个数组的count改成任意阿拉伯数字,我去,啥问题也没有啊~

不甘心啊~这么坑的事情,见了鬼了,好好看看自己的数据源吧~

发现一件事情,两个list过来后,我是直接刷新的section,注意,分别刷新的section,当时觉得reloadtableview有点浪费啊,就一个section而已,为嘛要刷整个table嘛~相信你也会这么想,算了,死马当成活马医,试试咯~

两个数组,一个刷新section,

self.orders = model;

NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:1];

[self.homeTable reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];

一个tableview reloaddata,

self.lawyers = model;

[self.homeTable reloadData];

运行~

OK啦~搞定!

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务