一直在搜索ios中的mod运算符,就像%在c中一样,但没有找到它的运气.尝试在此链接中的答案,但它给出了相同的错误.我有一个浮点变量'rotationAngle',其角度根据用户的手指移动保持递增或递减.有点像这样:
if (startPoint.x < pt.x) {
if (pt.y<936/2)
rotationAngle += pt.x - startPoint.x;
else
rotationAngle += startPoint.x - pt.x;
}
rotationAngle = (rotationAngle % 360);
}
Run Code Online (Sandbox Code Playgroud)
我只需要确保rotationAngle不超过+/- 360限制.任何帮助任何身体.谢谢
swift 中数据类型 Int 和 UInt8 之间有什么区别?
看起来 UInt8 用于二进制数据,我需要将 UInt8 转换为 Int 这是可能的。