CGPointMake在Swift中 [英] CGPointMake in Swift

查看:137
本文介绍了CGPointMake在Swift中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Swift 中使用 CGPointMake ?有它的等价物吗?我收到错误:


使用未解析的标识符'CGPointMake'


基本上,我正在尝试为Sprite Kit节点分配一个位置,但无法弄清楚如何在Swift中执行此操作。

  class PlayerSpaceship:Spaceship {

func launchMissile(){

var missile = missile.playerMissile()

/ /该行给出了上述错误。
missile.position = CGPointMake(0.0,0.0)
}
}


CGPoint(x:Float,y:Float)


How to use CGPointMake in Swift? Is there an equivalent for it? I am getting an error:

Use of unresolved identifier 'CGPointMake'

Basically, I am trying to assign a position to a Sprite Kit node and cannot figure out how to do it in Swift.

class PlayerSpaceship: Spaceship {

    func launchMissile() {

        var missile = Missile.playerMissile()

        // This line gives above mentioned error.    
        missile.position = CGPointMake(0.0, 0.0) 
    }
}

解决方案

Use CGPoint(x: Float, y: Float)

这篇关于CGPointMake在Swift中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆