Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop Animation doesn't work when viewControllers are presenting/dismissing #81

Closed
Mehrdadmaskull opened this issue Oct 9, 2016 · 2 comments

Comments

@Mehrdadmaskull
Copy link

Mehrdadmaskull commented Oct 9, 2016

Steps to reproduce:
Have a tableView in a viewController, add the loading, go to another viewController, do something network-related, add another loading, stop the loading animation after you receive a response, call a delegate method back and dismiss the current viewController, stop the animation in the delegate method, nothing happens.

I dug into the code and changed the following inside hide() method inside NVActivityIndicatorPresenter.swift from

for item in UIApplication.shared.keyWindow!.subviews
    where item.restorationIdentifier == restorationIdentifier {
        item.removeFromSuperview()
}

to

for window in UIApplication.shared.windows {
    for item in window.subviews
        where item.restorationIdentifier == restorationIdentifier {
            item.removeFromSuperview()
        }
}

and it works. Is there any reason why keyWindow is used instead of windows?

@ninjaprox
Copy link
Owner

@Mehrdadmaskull: keyWindow is used to add overlay view on top-most window so that it covers all beneath views. In your case, I guess that going to another view controller creates a new window on top of the one you added the loader. You could try debugging windows to see if there's new window added.

@ninjaprox
Copy link
Owner

Close this, reopen if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants