我想将字节转换为百分比。百分比将代表已上传文件的总量。将字节转换为百分比
例如,我有:
int64_t totalBytesSent
int64_t totalBytesExpectedToSend
我想将其转换成一个百分比(浮动)。
我已经试过这样:
int64_t percentage = totalBytesSent/totalBytesExpectedToSend;
这:
[NSNumber numberWithLongLong:totalBytesSent];
[NSNumber numberWithLongLong:totalBytesExpectedToSend];
CGFloat = [totalBytesSent longLongValue]/[totalBytesExpectedToSend longLongValue];
我觉得我缺少在努力做 '字节数学' 的东西。有谁知道如何将字节转换为百分比?
大!这工作!谢谢!我没有使用int64_t,它是来自块中第三方库的参数。 – tentmaking