如何将标签添加到子视图?

时间:2017-06-19 15:14:38

标签: ios sprite-kit

我有一个skscene,其中我显示子视图,我想要一个“Game Over”标签。

var gameoversub = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))

func addsubview() {
    gameoversub.backgroundColor = UIColor.black
    self.view?.addSubview(gameoversub)
    gameoversub.center = (super.scene?.anchorPoint)!
    gameoversub.bounds = CGRect(x: 0, y: 0, width: (super.scene?.frame.size.width)!, height:(super.scene?.frame.size.height)!)
    gameoversub.addSubview(titleLabel)
}

它说,我不能添加SKLabelNode,它想要UIView。一些解决方案?

0 个答案:

没有答案