iphone – UITableView自定义单元格滚动后消失的内容

iphone – UITableView自定义单元格滚动后消失的内容,第1张

概述我已经看过很多次这里被问到这个问题,但没有一个解决方案对我有用.这是我的代码片段: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellClassName = @"DemoTableViewC 我已经看过很多次这里被问到这个问题,但没有一个解决方案对我有用.这是我的代码片段:

- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{    static Nsstring *CellClassname = @"DemotableVIEwCell_sched";    DemotableVIEwCell_sched *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellClassname];    if (cell == nil)    {        NSArray *topLevelitems = [cellLoader instantiateWithOwner:self options:nil];        cell = [topLevelitems objectAtIndex:0];    }    cell.fooData = [self.BUGs objectAtIndex:indexPath.row];        return cell;}@H_502_12@  

然后我在VIEwDIDLoad中

cellLoader = [UINib nibWithNibname:@"DemotableVIEwCell_sched" bundle:[NSBundle mainBundle]];@H_502_12@解决方法 就我而言,发生的事情是我没有保持对tablevIEw的dataSource的强大指针.因此,当滚动tablevIEw时,数据源已经被释放并设置为nil,这导致tablevIEw的numRowsForSection为0,而cellForRowAtIndexPath为nils.  

如果有人遇到类似问题,您可能会查看是否正确保留了数据源和/或自定义对象.

总结

以上是内存溢出为你收集整理的iphone – UITableView自定义单元格滚动后消失的内容全部内容,希望文章能够帮你解决iphone – UITableView自定义单元格滚动后消失的内容所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1066854.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存