更新时间:2022-04-03 22:31:57
您可以像这样在 Swift 中将 Float
转换为 Int
:
You can convert Float
to Int
in Swift like this:
var myIntValue:Int = Int(myFloatValue)
println "My value is (myIntValue)"
您也可以通过@paulm 的评论实现此结果:
You can also achieve this result with @paulm's comment:
var myIntValue = Int(myFloatValue)