如果SKScene的默认锚点是(0,0)那么这会使场景的左上角粘在设备屏幕的左上角吗?
另外,如果是这样,使用一个场景支持多个设备的简单方法是什么?例如,默认场景大小(1024,768)只适合风景iPad,如果我在场景中放置一个节点(0,0),它就会出现在左下角。开发人员通常如何解决这个问题?
修改1
我尝试将场景的缩放模式设置为.ResizeFill
中的didMoveToView()
:
let screenWidth = UIScreen.mainScreen().bounds.width
let screenHeight = UIScreen.mainScreen().bounds.height
print("Screen size: (\(screenWidth), \(screenHeight))")
print()
print("Scene size before setting scaling: (\(self.frame.width), \(self.frame.height))")
print()
self.scaleMode = .ResizeFill
print("Scene size after setting scaling: (\(self.frame.width), \(self.frame.height))")
打印出来:
Screen size: (667.0, 375.0)
()
Scene size before setting scaling: (1024.0, 768.0)
()
Scene size after setting scaling: (1024.0, 768.0)