這裏是代碼,HUD隱藏得很快。我需要2〜5秒才能重新加載數據,有什麼方法可以加速或保持HUD的出現?MBProgressHUD隱藏在tableView之前reloadData()
func loadDorms() {
var hud = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
hud.labelText = "加載中"
hud.showAnimated(true, whileExecutingBlock:{
let manager = AFHTTPRequestOperationManager()
manager.GET(ServiceAPi.getRegionList(23),
parameters: nil,
success: {
operation,responseObject in
if let quote = responseObject as? NSArray {
self.dorms = quote
self.dorm = quote[0] as! NSDictionary
} else {
print("no quote")
}
self.leftTableView.reloadData()
self.rightTableView.reloadData()
}, failure: {
operation, error in
print("Error: " + error.localizedDescription)
})
}){
// 移除
hud.removeFromSuperview()
hud = nil
}
}
It works,thank you –
@BorongLi很高興幫助你!請將答案標記爲已接受。 – Rumin