我有一个视图,我已经使用xib文件创建.
现在我想在这个视图中添加一些小元素,这些元素可以使用SpriteKit的一些物理动画,所以现在我需要一个SKView.
是否可以将SKView添加为与我的xib视图对应的视图的子视图?我尝试了这个,它似乎没有显示任何东西.
以下是与我的XIB视图对应的ViewController:
this.myCustomSKView = new CustomSKView() this.View.AddSubview( this.myCustomSKView );
我的自定义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); } }
解决方法
我不知道你究竟想要实现什么,但我认为你可能想要查看UIKitDynamics而不是SpriteKit,它为视图和其他动态项目提供了“与物理相关的功能和动画”.我建议你先看一下apple doc
https://developer.apple.com/library/ios/samplecode/DynamicsCatalog/Introduction/Intro.html
然后
关于raywenderlich.com的一个非常好的教程
http://www.raywenderlich.com/50197/uikit-dynamics-tutorial
https://developer.apple.com/library/ios/samplecode/DynamicsCatalog/Introduction/Intro.html
然后
关于raywenderlich.com的一个非常好的教程
http://www.raywenderlich.com/50197/uikit-dynamics-tutorial
希望这可以帮助…
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。