I am trying to call the method below that was declared in the superclass
from its subclass
. However, inside the method self.navigationController
became nil
. The superclass's method was called from a completion closure of a NSURLSession task in the subclass.
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)
}
}
When I check the value of self in showSuccessHUDwithMessage:
I still get the subclass, but wasn't able to get its navigationController