Xcode9学习笔记79 - 使用Tread暂停动作的执行(让启动画面停留2秒再载入主界面)

    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, width: 240, height: 100))
        view.backgroundColor = UIColor.brown
        self.view.addSubview(view)
    }

  

 

posted on 2017-12-02 07:37  业余极客  阅读(357)  评论(0编辑  收藏  举报

导航