我遇到了以下崩溃问题:
CALayerInvalidGeometry CALayerInvalidGeometry
CALayer bounds contains NaN: [nan 0; nan 15.1]
在这段代码的最后一行:
CGRect bounds = self.bounds;
bounds.size = CGSizeMake(fabsf(self.width), self.height);
self.bounds = bounds;
其中self.width是由一个平移手势识别器来派生的:
CGPoint panGestureRecognizerTranslationPoint = [panGestureRecognizer translationInView:panGestureRecognizer.view.superview.superview];
CGPoint rotatedPanGestureRecognizerTranslationPoint = CGPointApplyAffineTransform(panGestureRecognizerTranslationPoint, CGAffineTransformMakeRotation(-self.angle));
self.width += rotatedPanGestureRecognizerTranslationPoint.x;
当我遇到这个崩溃时,唯一的共性就是错误信息里始终有[nan 0; 加上其它内容。请问有人知道是什么原因导致的吗?