Presenting a viewController on SKScene

后端 未结 2 603
梦毁少年i
梦毁少年i 2020-12-16 05:52

I am trying to present UIActivityViewController on an SkView but xcode gives me this error :

No visible @interface for \'Ga

相关标签:
2条回答
  • 2020-12-16 06:39

    We can use "presentModalViewController" by using this code to access the root view controller

     UIViewController *vc = self.view.window.rootViewController;
        [vc presentViewController: activityViewController animated: YES completion:nil];
    

    now it works fine !

    0 讨论(0)
  • 2020-12-16 06:43

    IIRC the first SKScene that you create is inside an SKView.

    This SKView is inside a UIViewController.

    You can use properties or delegation or whatever you like to access methods on the UIViewController through the SKView from the SKScene. Or even use a notification.

    Then on the UIViewController you can present the new view controller with no problems.

    0 讨论(0)
提交回复
热议问题