最常见的是
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 14]'*** Call stack at first throw
这种错误是在float经过函数运行出了不是数字的值,nan的意思就是not a number。
主要常见原因:
1.除以
2.sizeWithFont的字符串为nil
3.数学函数不正确运算
解决方法除了排除根源所在之外,用函数isnan()也是不错的选择(至少在没有彻底解决以前)
如下
if (!isnan(_x)) {
cell.imgView.frame = CGRectMake(_x, 8, 10, 12);
}```
其实大多数是第一个错误,只要加一句判断就可解决,即
```if (x>0)
{
//代码 --------
}```