将SpriteKit视图集成到xib视图中

L. *_*ins 5 xib xamarin ios7 sprite-kit skview

我有一个视图,我已经使用xib文件创建.

现在,我想一些小元素添加到这一观点,即会利用一些从SpriteKit物理动画的,所以现在我需要一个SKView.

是否可以将SKView添加为与我的xib视图对应的视图的子视图?我尝试了这个,它似乎没有显示任何东西.

以下是与我的XIB视图对应的ViewController:

this.myCustomSKView = new CustomSKView()
this.View.AddSubview( this.myCustomSKView );
Run Code Online (Sandbox Code Playgroud)

我的自定义SKView的ViewController有:

    public override void ViewWillLayoutSubviews ()
    {
        base.ViewWillLayoutSubviews ();
        if(this.SKView.Scene == null)
        {
            this.SKView.ShowsFPS = true;
            this.SKView.ShowsNodeCount = true;
            this.SKView.ShowsDrawCount = true;

            var scene = new MyCustomSKScene (this.SKView.Bounds.Size);
            this.SKView.PresentScene (scene);
        }
    }
Run Code Online (Sandbox Code Playgroud)

lio*_*dar -1

我不知道你到底想要实现什么,但我认为你可能想查看 UIKitDynamics,而不是 SpriteKit,它提供了“与物理相关的功能以及视图和其他动态项目的动画”。我建议您首先查看苹果文档 https://developer.apple.com/library/ios/samplecode/DynamicsCatalog/Introduction/Intro.html ,然后查看 raywenderlich.com http://www.raywenderlich 上的一个非常好的教程 。 com/50197/uikit-dynamics-tutorial

希望这可以帮助...