CGPointMake in Swift

蓝咒 提交于 2019-12-04 22:16:30

Use CGPoint(x: Float, y: Float)

You call it a little differently, without the make.

CGPoint(x: 10, y: 20)

Xcode 6.3.1 shows 4 different Swift initializers for CGPoint. They are:

CGPoint()
CGPoint(x: CGFloat, y: CGFloat)
CGPoint(x: Double, y: Double)
CGPoint(x: Int, y: Int)
Frank Schaefer

In the code it should looks like this (Xcode 6.1):

let point: CGPoint = CGPoint(x:10,y:10)

Or also, you can use CGFloat type for CGPoint

 CGPoint(x: CGFloat, y: CGFloat)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!