美文网首页
hread 1: "Invalid row height (na

hread 1: "Invalid row height (na

作者: 野咪咕 | 来源:发表于2021-06-25 16:32 被阅读0次

iOS 报错 Thread 1: "Invalid row height (nan) provided by table delegate

说明,row height 设置出问题了,不小心计算成了负值。 去设置 rowHeight的代理方法里面找就行。

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

或者设置 tableview 的 row height 的时候。除以0了 例如:

   imagemdoel.width = 0;imagemdoel.height = 0;

  CGFloat imageProportion = imagemdoel.width / imagemdoel.height;

   return SCREEN_WIDTH / imageProportion;

iOS  报错  CALayer bounds contains NaN: [0 0; 414 nan](null)

这种情况出现的原因就是:

 图片的宽高是后台返回的,高/宽的时候,其中宽高有时为0了,所以崩溃,切记要判断宽高不等于0 

常见在设置图片大小的时候,比如tableview的头部是个图片或者轮播图广告的时候

相关文章

网友评论

      本文标题:hread 1: "Invalid row height (na

      本文链接:https://www.haomeiwen.com/subject/aksoyltx.html