当请求失败时,SIAlertView
显示错误消息然后单击SIAlertView
的确定按钮,popViewController正常工作并且没有问题但是当我第二次尝试并请求失败时,popViewController再次工作但是那里是灰色和锁定的屏幕。屏幕没有给出任何回应。
如何解决此问题?
顺便说一下,我正在使用SVProgressHUD
来显示和隐藏加载程序。
self.showLoader()
showCardViewModel?.generateCard(success: { [weak self] (cardModel) in
guard let strongSelf = self else { return }
if let cardModel = cardModel {
strongSelf.cardModel = cardModel
}
self?.cardInfoView.isHidden = false
self?.bottomView.isHidden = false
strongSelf.hideLoader()
}, failure: { [weak self] (error) in
guard let strongSelf = self else { return }
strongSelf.hideLoader()
AlertHelper.showAlert(with: AlertType.error,
message: error.localizedDescription,
delegate: self)
})
扩展方法:
extension ShowCardVC: SIAlertViewDelegate {
func alertView(_ alertView: SIAlertView!, clickedButtonAt buttonIndex: Int) {
if let navController = self.navigationController {
navController.popViewController(animated: true)
}
}
}
答案 0 :(得分:1)
您应该将此控件添加到SIAlertView.m
if ([SIAlertView sharedQueue].count >= 1) { [SIAlertView hideBackgroundAnimated:YES]; }