gpt4 book ai didi

swift - 我的应用程序处于 200% 缩放状态

转载 作者:行者123 更新时间:2023-11-30 13:53:04 25 4
gpt4 key购买 nike

当我运行游戏时,缩放比例好像是 200%。我不知道该怎么做才能使它正常。

class GameViewController: UIViewController {

var scene: GameScene!

override func viewDidLoad() {
super.viewDidLoad()

// CONFIGURE THE VIEW
let skView = view as! SKView
skView.multipleTouchEnabled = false

// create and configure the scene
scene = GameScene(size: skView.bounds.size)
scene.scaleMode = .AspectFill

// Present the scene
skView.presentScene(scene)
}

p.s:我已经检查过了,它不在模拟器的设置中

最佳答案

场景看起来被缩放的原因是通过缩放因子 (AspectFill) 来解释的。您可能需要使用 FillResizeFill

使用SKSceneScaleMode,您有四个选项:

填充

Each axis of the scene is scaled independently so that each axis in the scene exactly maps to the length of that axis in the view.

外观填充

The scaling factor of each dimension is calculated and the larger of the two is chosen. Each axis of the scene is scaled by the same scaling factor. This guarantees that the entire area of the view is filled but may cause parts of the scene to be cropped.

方面适合

The scaling factor of each dimension is calculated and the smaller of the two is chosen. Each axis of the scene is scaled by the same scaling factor. This guarantees that the entire scene is visible but may require letterboxing in the view.

调整填充大小

The scene is not scaled to match the view. Instead, the scene is automatically resized so that its dimensions always match those of the view.

<小时/>

适用于 iOS 7.0 及更高版本。

https://developer.apple.com/library/prerelease/ios/documentation/SpriteKit/Reference/SKScene_Ref/#//apple_ref/c/tdef/SKSceneScaleMode

关于swift - 我的应用程序处于 200% 缩放状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34010856/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com