Mah*_*ray 3 xcode integer cgfloat ios swift
如何将@IValue CGFloat转换为Int?
我不断得到cannot convert @IValue CGFloat to Integer以下:
@IBOutlet var userObject : UIImageView
func returnYPosition(yPosition: Integer) -> Integer {
return userObject.center.y
}
Run Code Online (Sandbox Code Playgroud)
您需要Int来回传递类型,然后进行转换:
func returnYPosition(yPosition: Int) -> Int {
return Int(userObject.center.y)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5099 次 |
| 最近记录: |