大佬教程收集整理的这篇文章主要介绍了ios – 覆盖SKScene没有显示,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
有谁知道为什么?两个设备都在iOS 9.2.1上运行.我只测试了这两个型号的应用程序.这是我在GameViewController.Swift中的代码
//Configure the view sceneView = self.view as? SCNView //Configure the scene sceneView.scene = gameScene sceneView.playing = true sceneView.BACkgroundColor = UIColor.blackColor() sceneView.antialiasingMode = SCNAntialiasingMode.Multisampling4X let overlayScene = OverlayScene(size: self.view.bounds.sizE) sceneView.overlaySKScene = overlayScene
谢谢!
在Xcode提供的库存/模板代码中,Storyboard将顶级视图指定为SKView,并且应通过SCNView对象将初始SCNScene添加到该视图中.这意味着当我向SCNScene添加SKView时,我遇到了一个问题,即SKView不会在任何使用OpenGL的设备上显示(而不是Metal).
@H_855_5@main.storyboard – > ViewController – >视图应设置为SCNView,而不是SKView.
然后,在ViewController中:
- (void) viewDidLoad { [super viewDidLoad]; // Configure the root view. // SCNView *scnView = (SCNView*)self.view; WorldSceneView *world = [[WorldSceneView alloc] initWithFrame:self.view.frame]; // Create and configure the scene. // HUDScene *hudScene = [HUDScene hudSceneWithSize:scnView.bounds.size andHUDDelegate:world]; // Associate the HUD SKScene with the SCNView. // world.overlaySKScene = hudScene; [scnView addSubview:world]; }
这适用于我,在Metal和OpenGL设备以及模拟器上.
以上是大佬教程为你收集整理的ios – 覆盖SKScene没有显示全部内容,希望文章能够帮你解决ios – 覆盖SKScene没有显示所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。