-
Notifications
You must be signed in to change notification settings - Fork 182
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
Cells seemed to be cached #24
Comments
I've never encountered caching before as this is the first time someone's posted the bug on GitHub. I'll try get this fixed and a patch/reason why it's happening tomorrow. Thanks for filing the bug report! |
i am also facing this problem. please help! |
I seem to have the same issue. Old badges appear when I reloadrowsatindexpaths on another cell. |
I can't for the life of me recreate this. Can someone supply an example project replicating the issue? @Andrewtait this is interesting as cells won't redraw unless told to by the table view. |
hi tmdvs. I'll try to come up with a demo project. unfortunately I just cant give you my active project code as the badges are updated by messages coming through sockets. I'll reply back once I get a usable demo project that reproduces the error. |
Okay, I came up with an example that shows this problem. The sample app simply has a timer that loops every 5 seconds. On each loop, one cells badge is updated. My app follows a similar approach to filling the badges in. Upon row selection, the badge string is set to nil, and then once data from a socket comes in, the badge is set to the appropriate number. Hope this helps. |
I'm seeing this same issue. I've got some static cells that update badge counts on the fly - unfortunately, the updates only appear when you select the row, instead of updating as they're told. self.cell1.badgeString = @"2"; //doesn't update the badge until the row is selected. if i run this call on a timer or from some other event, the badge doesn't ever update until you select the row. |
That problem isn't caching. The badge actually doesn't redraw once the cell is drawn. You could tell the badge to redraw with setNeedsDisplay however I will patch this to be automatic tonight. Sent from my iPhone On 22 Mar 2013, at 03:58 PM, Mitch Kramer notifications@github.com wrote:
|
@mmarszal @mitchkramez @Andrewtait @AzkaarAli I'm going to do a fairly extensive rewrite of the class tonight to hopefully solve everyones problems. Its great that many others have contributed fixes but I think the time has come just to tidy the code up a little. I'll notify you all when I push a fix tonight. |
@tmdvs calling [self.cell1.badge setNeedsDisplay]; doesn't seem to have any effect on the badge appearing. it still doesn't appear until i've selected the row. thanks all the same, this class is very interesting and a learning experience for me. i appreciate the responses, time, and code you've put into this very much. |
@tmdvs I tried fixing this problem myself in the past as well, however, when it comes to core graphics, layers and animations, I'm not too useful. I only have a basic idea when it comes to layers and such (next thing on my to-learn list). But as @mitchkramez said, we appreciate the effort you've done with this class. I couldn't have my nice UI without it! |
@mitchkramez I've just pushed to the repo a fix for your issue. Simply changing the badge string should now auto redraw it! |
@mmarszal @mitchkramez @Andrewtait @AzkaarAli I've now fixed this caching bug! Check out the latest version! |
Awesome - this is working as I'd expect it to now... incredible! |
Great work, Tim. I had to do a custom cell as I was under a deadline, but will return to this in my next app. Thanks. |
works extremely perfectly now! Thanks for your hard work @tmdvs, it's quite appreciated. |
Just wanted to thank you for your efforts @tmdvs, I was experiencing the same problem replacing my outdated files with the latest version fixed the problem. Thanks! |
I still meet the same problem with the newest code. |
@starecho Can you provide an example where this is happening? |
Hi there,
I've been using TDBadgedCell now for a while, and it seems like the cells are being cached.
When the method cellForRowAtIndexPath gets called, after getting a cell from the reuse queue, I immediately do a [cell setBadgeString:nil];
This works great, and the badge gets turned off. However, if I have more than 1 cell, after getting the requested cell, the other cells seem to use some cached value. This only happens after selecting the cell.
The code to setup the cell is as follows:
So the flow of how i see the caching goes like this.
Create 3 cells with badges all set initially to nil.
I receive data, from 3 sources, then I set the badges to 3 different values.
Upon touching a cell, i set the badge to nil. I do this to each and every 3 cells.
Then I receive data from only one source. I then set the badge count to this value.
Upon setting the value, the other 2 cells now seem to have their data set, but form completely old value. Here is where i seem to get the cached data.
I'm really not sure how to debug this either. I set a debug point on cellForRowAtIndexPath to see if the other cells were being updated, but only the cell that was tapped gets updated by cellForRowAtIndexPath.
I've done some googling on this, and it seems some other users have ran into a similar problem. One example is here:
http://stackoverflow.com/questions/2215075/caching-issues-with-tdbadgedcell
However, this comes from 2010, and Im not sure if this issue was noticed before and fixed.
Can anyone shed any light on this? Is the information i posted above enough? Or do you need more?
Thank you
The text was updated successfully, but these errors were encountered: