Giter Club home page Giter Club logo

Comments (6)

luispadron avatar luispadron commented on May 16, 2024

First: There is no reason why you created duplicate issues as issues can be edited, just a tip for the future as this clutters my issues.

Second: Please follow the issue submission template before posting an issue.

Finally: This seems to be an issue with your logic, you cannot animate in cellForItemAt as this is called before the view is even presented which is why you do not see the animation but you get a callback. You will need to find a better place to animate your cells. Try viewDidAppear or viewWillAppear.

Let me know if this solves your issue.

from uicircularprogressring.

scastro avatar scastro commented on May 16, 2024

First: It was obviously an error...as you can see I closed the previous one...

About the issue, to be honest, this is the first library that doesn't work on the cellForItemAt or willDisplay of a collection, doesn't make much sense have to handle the animations inside a cell from outside the collection.

If I put the code on the viewDidAppear of the VC it works, but only for the first cell of course. As soon as I go to the next cell, the animation doesn't work.

I'm trying to solve this but still no luck...

from uicircularprogressring.

luispadron avatar luispadron commented on May 16, 2024

Sorry for coming off as a bit annoyed, it's just people really don't like to follow the proper way of submitting issues which makes it way harder to fix problems.

I haven't used too many collection views in the past and have not tested this lib with the use of cells. I just know that if it works like a tableView does then cellForItemAt will get called before the view appears, this is because it needs to load that data to present the cell to the user. Test it by putting a break point there. The lib is working as you get a call back after animation completion, you just can't see the animation due to the fact the view wasn't on screen.

Have you tried using willDisplayCell and calling setProgress there? Besides this to continue forward and see if this is a bug with the library, I would need some sample code or for you to email me or post the full project. Email me here if you prefer to keep it private.

from uicircularprogressring.

scastro avatar scastro commented on May 16, 2024

No worries.

Yes, I tried on willDisplayCell and has the same issue.

One way I fixed the issue is calling a selector with a delay after the willDisplayCell, which of course sucks but I tried to test stuff and this worked.

But after that I remember that CollectionView is a ScrollView, so I use the scrollViewDidEndScrollingAnimation to set the progress and now is working. Of course you have to store the current cell in the screen for this (and also for reseting the progress when you reenter the screen after pushing another VC, which btw only works if I set the progress to 0 on the completion block of the previous setProgress).

Either way, if you want a sample project I could build something based on my current project. I tried to debug your code in order to try to fix the issue on the library but I'm not too good with the animation framework...

from uicircularprogressring.

luispadron avatar luispadron commented on May 16, 2024

Yeah if you have the time I'd appreciate an example project or something with reproducible behavior as I am currently busy with work and school and this will speed things up, thanks!

from uicircularprogressring.

luispadron avatar luispadron commented on May 16, 2024

So I've taken a look at the project you sent me and yes I definitely see what you're saying now. I'm not sure this is a bug with this project in particular just yet. Since it seems odd that this animation works fine every where else, except for the first two items in a collection view...

Found this repo while doing more research and it seems like thats the same thing you're experiencing. I'll take another jab at it whenever I get another chance.

In the mean time I will post what you did to work around it, in the case anyone else is experiencing this.

For others
@scastro is experiencing an issue with the first few items not showing the animation. He has a CollectionView which automatically scrolls through some cells. The first two cells were not animating. He was doing the animation code inside of willDisplayCell of the collectionView delegate.
To work around this he removed the animation code from there and did this

    func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
        cell.ring.setProgress(value: 100, animationDuration: 2.0) {
            print("Progress finished")
        }
    }

from uicircularprogressring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.