UIWebview加载开始后,iOS UI会卡住几秒钟

时间:2016-12-05 21:49:13

标签: ios swift

iOS UI动画在加载webview(url请求)时卡住了几秒钟。 UIWebview是背景视图,UIAnimation用于弹出视图。

override func viewDidLoad() {
    super.viewDidLoad()

    if let url = URL(string: "http://www.nyforseniors.com") {
        let urlRequest = URLRequest(url: url)
        self.webView.loadRequest(urlRequest)
    }

    NotificationCenter.default.addObserver(forName:     Notification.Name("SHOW_QUIZ"), object: nil, queue: nil, using: {     notification in
        self.performSegue(withIdentifier: "sid_quiz", sender: self)
    })
}

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    if Manager.sharedInstance.isFirstLoad{
        Manager.sharedInstance.isFirstLoad = false
        self.openQuiz()
    }
} 

func openQuiz() {
    self.performSegue(withIdentifier: "sid_welcome", sender: self)
}

如何解决这个问题?

0 个答案:

没有答案