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

View is hidden by the stopAnimation method? #55

Closed
whisper-bye opened this issue Aug 29, 2016 · 8 comments
Closed

View is hidden by the stopAnimation method? #55

whisper-bye opened this issue Aug 29, 2016 · 8 comments

Comments

@whisper-bye
Copy link

whisper-bye commented Aug 29, 2016

@ninjaprox
// this is my test code

self.activityIndicatorView.startAnimation()
self.activityIndicatorView.hidesWhenStopped = false

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(NSEC_PER_SEC * 3)), dispatch_get_main_queue()) {
    self.activityIndicatorView.stopAnimation()
}

Even if I wrote self.activityIndicatorView.hidesWhenStopped = false, The view is still hidden?

@ninjaprox
Copy link
Owner

@whisper-bye: Just checked the code

public func stopAnimation() {
    self.layer.sublayers = nil
    self.animating = false
    if hidesWhenStopped && !hidden {
        hidden = true
    }
}

When stopAnimation() is called, it removes all sublayers. That is why the view looks like hidden regardless hidesWhenStopped. Anyway, I will refine this method and behavior, but PR is always welcome.

@ninjaprox
Copy link
Owner

@whisper-bye: I've decided to remove hidesWhenStopped in next major release (3.x). The expected behavior now should be that before starting and stopping animating, nothing should be appeared but its background color. Also considering to hide the view itself before starting and after stopping.

@whisper-bye
Copy link
Author

@ninjaprox
Thanks for your work. I will check it out later.

@otymartin
Copy link

otymartin commented Sep 15, 2016

@ninjaprox For some reason, my indicator does not hide when i call self.activityIndicator.stopAnimating()

UPDATE:
Nevermind, lousy programming from yours truly 😅

@ninjaprox
Copy link
Owner

@otymartin: What could I do to improve it?

@otymartin
Copy link

@ninjaprox it's perfect actually, I haven't had any problems with it at all. One usecase I'm going to attempt (It may be outside the focus scope) is at startAnimating -> I would like to automatically blur the view below. I use this library for video so while buffering, it makes for a nice effect.

Thanks alot for the library btw 💯

@ninjaprox
Copy link
Owner

@otymartin: Thanks! Perhaps I think that's good idea to add. I will try, PR is welcome though. 😄

@otymartin
Copy link

@ninjaprox I would but Im too new to swift & github (programming in general)😫🙈

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

3 participants