Swift - 显示术语" inView"

时间:2016-12-22 18:08:12

标签: swift xcode view position

import SpriteKit
import UIKit
import Foundation

class GameScene: SKScene {

let coin = Coin()

    override func didMoveToView(view: SKView) {
    /* Setup your scene here */
        coin.coinFlip(inView view: UIView)

        }

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
   /* Called when a touch begins */
       }

override func update(currentTime: CFTimeInterval) {
    /* Called before each frame is rendered */
}
}

Xcode不会让我把'#34; coinFlip&#34;功能!它说我必须在&#34; inView之后加一个逗号,&#34;然后它说&#34;使用未解析的标识符&#39; inView&#39;&#34; 。在这种情况下我该怎么办?

1 个答案:

答案 0 :(得分:2)

类Coin不会从具有view属性的类继承。假设您想在翻转硬币方法中引用该视图,请向该函数添加一个参数以将其传入。

func coinFlip(inView view: UIView)