社区
iOS
帖子详情
reloadData方面问题,请大神帮忙看看
nicookly
2014-09-22 04:43:53
加精
didSelectRowAtIndexPath中调用一次[self.tableview reloadData] 后, 且 numberOfRowsInSection的返回值为1,却调用了两次cellForRowAtIndexPath,也创建了两次cell,且只显示一行(cell是用xib 实现的自定义cell)?????求解,急,大神如果知道,还请赐教。
...全文
1515
15
打赏
收藏
reloadData方面问题,请大神帮忙看看
didSelectRowAtIndexPath中调用一次[self.tableview reloadData] 后, 且 numberOfRowsInSection的返回值为1,却调用了两次cellForRowAtIndexPath,也创建了两次cell,且只显示一行(cell是用xib 实现的自定义cell)?????求解,急,大神如果知道,还请赐教。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
15 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Java 狂魔
2014-09-28
打赏
举报
回复
很好,很有用,谢谢。
nettman
2014-09-24
打赏
举报
回复
CodeC
2014-09-24
打赏
举报
回复
为什么就不给一个机会,自己强大才能保护他人
程老师2088
2014-09-23
打赏
举报
回复
应该是有别的地方重复调用了。。楼主仔细检查下
laoer_2002
2014-09-23
打赏
举报
回复
还是要好好学习
wanruochuwenyy
2014-09-23
打赏
举报
回复
好高端的样子啊 完全不懂啊
hugh_z
2014-09-23
打赏
举报
回复
learning
ReyZhang
2014-09-23
打赏
举报
回复
断点看一下numberOfRowsInSection 这个代理方法执行几次?如果也执行了两次,可以确定重载了两次数据。还是仔细检查一下。
Bannings
2014-09-22
打赏
举报
回复
你在cellForRowAtIndexPath方法里下断点,能看到两次调用的时机么
nicookly
2014-09-22
打赏
举报
回复
引用 1 楼 zhangao0086 的回复:
是不是在其他的地方也有调用的代码?或者tableView有几个实例?
我也只是 触发单击事件里 调用了 reloadData 而且是在viewDidLoad 中创建的tableView。
nicookly
2014-09-22
打赏
举报
回复
引用 2 楼 hantianjie_ 的回复:
代码贴出来看看
代码 已贴出
nicookly
2014-09-22
打赏
举报
回复
只在viewDidLoad中创建了一个 tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 110,[UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height - 110) style:UITableViewStylePlain]; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *TableSampleIdentifier = @"TableSampleIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TableSampleIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableSampleIdentifier]; //在添加cell时添加边线框 UIView *backView = [[UIView alloc] initWithFrame:cell.frame]; backView.layer.masksToBounds = YES; backView.layer.cornerRadius = 1.0; backView.layer.borderWidth = 1.0; backView.layer.borderColor = [[UIColor lightGrayColor] CGColor]; [cell addSubview:backView]; } if (_chapterList.count == 2) { NSLog(@"sdasdasdsdasd111111111111"); } NSUInteger row = [indexPath row]; cell.textLabel.text = [[_chapterList objectAtIndex:row]objectForKey:@"type_name"]; return cell; } ================= - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; //这部分解析xml 的 self startParseQuestion:[[_chapterList objectAtIndex:row] objectForKey:@"id"] ]; [_questionList removeAllObjects]; // 将解析到的数据放入_questionList中 [_questionList addObjectsFromArray:[myPlayer questionDataArray]]; if (_questionList.count == 0) { UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该部分内容正加紧录制中,敬请期待!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alter show]; } else { [self.tableview reloadData]; } } ============ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (isQuestion != NO) { NSLog(@"_questionList.count::::%d",_questionList.count); return _questionList.count; } else { NSLog(@"_chapterList.count::::::%d",_chapterList.count); return _chapterList.count; } }
hantianjie_
2014-09-22
打赏
举报
回复
代码贴出来看看
Bannings
2014-09-22
打赏
举报
回复
是不是在其他的地方也有调用的代码?或者tableView有几个实例?
UITableView——
reload
Data
与
reload
Section性能比较1
UITableView——
reload
Data
与
reload
Section性能较周五上午,测试,有bug:每次reset模拟器后,第次进界,闪退,第次进界,结果
详解ios监听
reload
Data
刷新列表完毕的时机
主要介绍了详解ios监听
reload
Data
刷新列表完毕的时机,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来
看看
吧
iOS开发:UICollectionView的
reload
Data
失效
问题
Objective-C开发iOS App中的UICollectionView调用
reload
Data
失效
问题
。 最近开发时遇到一个业务场景如下: App的首页有一个直播课程入口卡片,卡片上会显示一个数据。点击卡片进入二级页面后,有一个操作会改变这个数据,并且会发一个通知,首页监听这个通知,收到通知后在回调里调用
reload
Data
重新加载数据。遇到的
问题
是直接调用
reload
Data
失效。打断点发现数据正常修改了,Cell也正常刷了,但是切会主页后卡片上的数据还是没有正常显示。 经过检查代码后发现,在
iOS开发,有时tableView无法
reload
Data
操蛋
问题
解决办法
今天在开发中碰到一个非常操蛋的
问题
,调用[self.tableview
reload
Data
]后无法刷新页面 我是在做环信删除聊天会话列表时碰到这个
问题
。 什么都对,就是不知为何无法刷新! 没办法,上百度谷歌一下发现还真有人跟我碰到一样的
问题
,
大神
解决办法是不要用懒加载加载tablview,直接在viewDidLoad中添加tableview页面。 当时我真不信,懒加载怎么可能会出
问题
,这...
iOS tableView
reload
Data
抖动
问题
在使用自动布局之后,屏幕刷新调用
reload
Data
会间歇性的抖动,体验及其差。 产生原因: 在使用自动布局之后,UITableViewAutomaticDimension 高度自动适应,就是每次计算高度的时候产生闪动,我怀疑过scroll动画,频繁调用,但是最终原因是这个自动布局计算cell高度。 解决方法: 对自动计算的高度进行缓存,仔细观察,第一次出现的时候不抖动的。 代
iOS
29,031
社区成员
12,466
社区内容
发帖
与我相关
我的任务
iOS
主要讨论与iOS相关的软件和技术
复制链接
扫一扫
分享
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章