0
我試圖使UiTextField框架將根據屏幕大小和方向調整大小,但我沒有太大的成功。 (Frame作爲在uitextfieldname.frame(X:,Y:,寬度:,高度:)下面是我的代碼:如何使UiTextField框架自動調整
import SpriteKit
import GameplayKit
import UIKit
class GameScene: SKScene {
override func didMove(to view: SKView) {
// Get label node from scene and store it for use later
let animateList = SKAction.sequence([SKAction.fadeIn(withDuration: 1.0), SKAction.wait(forDuration: 2.0), SKAction.fadeOut(withDuration: 1.0)])
let startScreen = SKLabelNode(fontNamed: "Helvetica Neue UltraLight")
startScreen.text = "Welcome"
startScreen.fontSize = 100.0
startScreen.fontColor = SKColor.white
startScreen.position = CGPoint(x: self.frame.midX, y: self.frame.midY)
self.addChild(startScreen)
startScreen.alpha = 0.0
startScreen.run(animateList)
_ = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: false) { _ in
startScreen.text = "I don't belive we have met before"
startScreen.run(animateList)
}
_ = Timer.scheduledTimer(withTimeInterval: 10.0, repeats: false) { _ in
startScreen.text = "What's your name?"
startScreen.run(animateList)
}
_ = Timer.scheduledTimer(withTimeInterval: 15.0, repeats: false) { _ in
let name = UITextField()
//name.frame = CGRect(x: ,y: ,width: , height:)
}
}
}
PS
重要/相關在基碼
您是什麼意思,*重要/相關的代碼在基礎*? – TriskalJM