错误详情:
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 2.5]'
原因:
计算 高度 或者 宽度 的时候,分母可能为0的情况下,会报出此错误。
如下:
如果没有 if 判断,则 s_height 可能为 0 。
CGFloat s_height = model.height / 5 ;
CGFloat s_width = 0;
if (s_height) {
s_width = (s_height / model.height) * model.width;
}
-----------------------------------------------------------
个人博客:https://blog.csdn.net/Crazy_SunShine
Github:https://github.com/cxymq
个人公众号:Flutter小同学
个人网站:http://chenhui.today/
---------------------