override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //主线程休眠2秒,启动画面将停留2秒 Thread.sleep(forTimeInterval: 2) let view = UIView(frame: CGRect(x: 40, y: 80, 240, height: 100)) view.backgroundColor = UIColor.brown self.view.addSubview(view) }