Why is there a difference between a progress of 0.2
and 0.20
? I'm really missing something here.
I have a dynamic total count of data and each data has a page.
let totalDataCount = 5
self.progressView.progress = Float(1/self.totalDataCount) // quotient: 0.2```
While if I set 0.20, I have this:
self.progressView.progress = 0.20
The division 1/5 returns 0 as a result because 1 is type of Int and the result is also Int. Try to change the 1/self.totalDataCount
to 1.0/self.totalDataCount
and it will work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.