我试图制作一个根据屏幕大小和方向调整大小的UiTextField框架,但我没有取得多大成功。 (框架如uitextfieldname.frame(x:,y:,width:,height:)这是我的代码:
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: )
}
}
}
P.S
基地的重要/相关代码
答案 0 :(得分:0)
您需要使用document.getElementById('video_ID').play(); document.getElementById('video_ID').pause();
约束autolayout
并设置pinned leading, trailing, top and bottom constraints
才能调整框架。