如何从GameScene刷新GameViewController?

时间:2016-02-12 01:56:35

标签: ios swift uiviewcontroller

我在应用内购买后成功测试了广告的删除情况。我需要的只是在完成付款后,交易完成后,当前GameScene上的横幅广告仍然存在。为了删除它们,我必须重新启动应用程序。我的GameViewController检查了viewDidLoad函数。我如何刷新"事务在GameScene中完成后的viewDidLoad?

override func viewDidLoad() {
    super.viewDidLoad()

    NSNotificationCenter.addObserver(self, selector: "doRemoveAds:", name: "RemoveAds",object:nil)
    if let scene = StartScene(fileNamed:"StartScene") {

        let skView = self.view as! SKView
        skView.showsFPS = false
        skView.showsNodeCount = false
        skView.ignoresSiblingOrder = true
        scene.scaleMode = .AspectFill
        skView.presentScene(scene)
    }

    if NSUserDefaults.standardUserDefaults().boolForKey("RemoveAds") == false{
        loadBanner()
    }
}

@objc func doRemoveAds(notification: NSNotification) {
    adBanner.hidden = true
}

0 个答案:

没有答案