如何使用CGPointMake
in Swift
?有没有相当于它?我得到一个错误:CGPointMake in Swift
Use of unresolved identifier 'CGPointMake'
基本上,我想分配给雪碧套件节点的位置,且无法弄清楚如何做到这一点的斯威夫特。
class PlayerSpaceship: Spaceship {
func launchMissile() {
var missile = Missile.playerMissile()
// This line gives above mentioned error.
missile.position = CGPointMake(0.0, 0.0)
}
}
我能够在Swift中编译'var p = CGPointMake(0,0)'就好了。是否有可能你没有包含CoreGraphics框架? –
我非常确定CGPointMake只存在,因为NeXTSTEP在C99出现之前:'(CGPoint){0.0,0.0}' –
@AaronGolden,谢谢。事实上,增加'导入CoreGraphics'解决了这个问题。 – RaffAl