Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将@IValue CGFloat 转换为 Int?
我不断收到cannot convert @IValue CGFloat to Integer以下内容:
cannot convert @IValue CGFloat to Integer
@IBOutlet var userObject : UIImageView func returnYPosition(yPosition: Integer) -> Integer { return userObject.center.y }
您需要Int来回传递类型,然后只需转换:
Int
func returnYPosition(yPosition: Int) -> Int { return Int(userObject.center.y) }