1
我有一個小問題,我的簡單iOS應用程序: 只有2個視圖,第一個發送數據到第二個(異步然後第二個數據顯示之前,數據是下載,但是當我在控制檯中打印這些數據時,我可以看到它們的下載速度非常快)。編輯標籤在下一個視圖很長
問題是我必須等待幾秒鐘(10到20秒之間)才能看到label
的更改。 此問題只發生在label
,例如我在label
之後填充我的imageView
,並立即應用圖像上的更改。
這裏是第一視圖的代碼:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "profilevc")
{
let dvc = segue.destination as! ProfileController;
dvc.data = self.loginField.text;
_ = ftRemote(login: dvc.data, view: dvc);
}
}
這裏被稱爲在ftRemote()
功能,其中label
是填入:
private func populateView(user: UserProfile)
{
self.pfView.loginLabel.text = user.login;
self.pfView.fullnameLabel.text = user.firstname! + " " + user.lastname!;
self.pfView.phoneLabel.text = user.phone;
self.pfView.walletLabel.text = "Wallet: " + String(Int(user.wallet!))
self.pfView.correctionLabel.text = "Correction: " + String(Int(user.correctionPoints!))
self.pfView.levelLabel.text = String(Float(user.level!))
self.pfView.profilePicture.downloadedFrom(link: user.imageUrl!)
}
有人能解釋這種延遲?
謝謝
UI更新必須在主隊列上完成。 – rmaddy