我想在按下按钮移动另一个 ViewController
时显示进度条(此 ViewController
从 WebService 加载了大量数据)并加载所有数据后进度条将被关闭。
我的意思是先按下一个按钮,然后立即移动到另一个带有进度条的 ViewController
,加载所有数据后进度条消失。
这里我添加了移动到另一个ViewController
的代码:
UIStoryboard *sb=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
Guide *guideVC = [sb instantiateViewControllerWithIdentifier:@"Guide"];
[self.navigationController pushViewController:guideVC animated:YES];
WebService 只需在新的 ViewController
上获取 viewDidLoad
方法即可。
我该怎么做。任何人给出解决方案。
最佳答案
Here i have just show you how to dissmiss SVProgress Here i have used my own APIManager(Using Alamofire) Custom class for Api calling
override func viewDidLoad() {
super.viewDidLoad()
self.fetchList()
}
func fetchList() {
SVProgressHUD.show()
APIManager.callAPIRequest(Method: .post, url: urlStr, parameters: parameters, headers: headers, completion:
{ (result, headerMessage) in
let dicJSONResponse = result.dictionaryValue
//SuccessBlock
SVProgressHUD.dismiss()
}) { (httpresponse, errorMessage) in
//Failure blog
SVProgressHUD.dismiss()
}
}
关于ios - 移动到另一个 ViewController 时如何设置和关闭 SVProgressHUD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46405235/