[英]Swift type conversions: Getting color data as CGFloat to an NSData of 8bit integers
[英]Swift conversions, CGFloat to Integer
你如何將@IValue CGFloat轉換為Int?
我不斷得到一個cannot convert @IValue CGFloat to Integer
的方法如下:
@IBOutlet var userObject : UIImageView
func returnYPosition(yPosition: Integer) -> Integer {
return userObject.center.y
}
你需要來回傳遞Int
類型,然后才轉換:
func returnYPosition(yPosition: Int) -> Int {
return Int(userObject.center.y)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.