-
Notifications
You must be signed in to change notification settings - Fork 226
Images change places in TableView #20
Comments
Yeah I suppose I never considered these to be used in a tableview. I'll look into it, or feel free to come up with something yourself and pull request. Thank you. |
@dosymbaev are you able to put together a quick demo app showing this? |
Closing due to inactivity. |
I am facing the same issue using a I am downloading images from a database and if I scroll before some images are loaded into the cell, I get occasional same images in different cells. Can you take a look at this? I would provide you a sample code, but my app has a lot of code and eliminating only what's useful for you would take a long time. Thanks |
I'll have a look. Extensions seem to be rather limited with what we can do, but I might be able to work something out. |
Wow, that's the fastest reply from a developer I've ever seen. Thanks! Please let me know as soon as you can resolve. I would love to use this for my app! |
No problem :) |
I’m able to reproduce this problem. The key point is that the face recognition is done in a background thread and when it’s done the image is set. When images are set very fast (during table view scroll) those background tasks build up and one can see successive image changes. Theoretically even the wrong image can be set in the end (can’t reproduce that). To solve that we would need to cancel previous tasks when setting a new image. Or check at the end of background processing that the image wasn’t changed. Anyway all this requires a new property added, which is not possible in a Swift extension. In fact it’s possible through an objective c hack, but a direct approach would be to switch to inheritance instead of extension. Not sure what approach would be better. |
It’s unfortunate that we’re limited in this way with extensions. I’d like to avoid going down the inheritance route.
I’m aware of the objective-c hack you’re talking about, and while not ideal, it might be the best way forward.
I suppose another option is to bundle in a singleton with this extension that could act as a datasource, but that kind of gets far beyond the scope of this project.
If anyone would like to have a go at the objective-c solution, (I don’t have a lot of time at the moment) I can review it, and we could use that in the meantime.
… On 11 Feb 2018, at 2:54 am, algrid ***@***.***> wrote:
I’m able to reproduce this problem. The key point is that the face recognition is done in a background thread and when it’s done the image is set. When images are set very fast (during table view scroll) those background tasks build up and one can see successive image changes. Theoretically even the wrong image can be set in the end (can’t reproduce that).
To solve that we would need to cancel previous tasks when setting a new image. Or check at the end of background processing that the image wasn’t changed. Anyway all this requires a new property added, which is not possible in a Swift extension. In fact it’s possible through an objective c hack, but a direct approach would be to switch to inheritance instead of extension. Not sure what approach would be better.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub <#20 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AM0dG53XFwARieBoNRt66vs8eJ97GQ1vks5tTbvFgaJpZM4Omhm2>.
|
Ok, I solve it with The code. @objc
Thanks. |
Where and how do you use this? |
When I scroll the images are set not on proper cells, then when i stop scrolling it reloads and puts back the correct image.
The text was updated successfully, but these errors were encountered: