我正在尝试对速度计进行编程!我有一个针图像,我希望针根据当前的下载速度旋转。
我有以下方法,但它不起作用。当我用 CurrentDegress 更新我的针头时,它永远不会下降,只会越来越高;针绕着圆圈旋转……有人吗?!
- (void) recalculateDegrees:(CGFloat) currentlyLoadedBytes
{
if(bytes <= 0){
currentDegrees = 0;
}
else if (bytes > completeFileSize){
currentDegrees = MAX_DEGREES;
}
else {
CGFloat log_tmp =(CGFloat) log10f(currentlyLoadedBytes / 1000);
currentDegrees = (log_tmp/5.0f)*290.0f;
}
//code to rotate image to currentDegrees
}