我正在尝试从superclass
调用subclass
中声明的以下方法。但是,方法self.navigationController
内部变为nil
。 超类的方法是从子类中NSURLSession任务的完成闭包调用的。
func showSuccessHUDwithMessage(msg: String) {
dispatch_async(dispatch_get_main_queue()) {
let successHud = MBProgressHUD(view: self.view)
self.navigationController?.view.addSubview(successHud)
successHud.mode = .CustomView
successHud.customView = UIImageView(image: UIImage(named:"37x-Checkmark"))
successHud.labelText = msg
successHud.show(true)
successHud.hide(true, afterDelay: 1.0)
}
}
当我在showSuccessHUDwithMessage:
中检查self的值时,我仍然会得到子类,但是无法获得navigationController