【发布时间】:2016-04-13 17:54:09
【问题描述】:
我有一个 UIImageView 供用户查看(看起来几乎像一个启动屏幕),以便我可以预加载我的纹理图集。
但似乎在完成块中,即使我说“removefromsuperview”它也没有这样做。
我知道纹理已完成加载,因为如果我点击屏幕,UIImageView 会消失并且我的游戏会开始,但由于某些奇怪的原因它不会自行消失。
这是我的 GameViewController 中的 viewDidLoad:
//Configure the View
let skView = view as! SKView
skView.multipleTouchEnabled = false
self.view.exclusiveTouch = false
//Create and Configure the scene
scene = GameScene(size: skView.bounds.size)
scene.scaleMode = .AspectFill
//Load "SPLASH SCREEN"
let image: UIImage = UIImage(named: "ViewControllerImage")!
GameViewController.splashView = UIImageView(image: image)
GameViewController.splashView!.frame = CGRectMake(0,0,self.view.bounds.width,self.view.bounds.height)
self.view.addSubview(GameViewController.splashView!)
SKTextureAtlas.preloadTextureAtlases([GameViewController.diploTextureAtlas,GameViewController.bieberTextureAtlas,GameViewController.skrillexTextureAtlas,GameViewController.sunTextureAtlas], withCompletionHandler: { () -> Void in
print("Completo")
GameViewController.splashView?.removeFromSuperview()
skView.presentScene(self.scene)
})
【问题讨论】:
标签: swift uiimageview texture-atlas