IKImageBrowserView Thumbnail Problem

点点圈 提交于 2019-12-13 05:06:04

问题


I download IKImageBrowserView sample named "IKImageKit Demo" from Apple official website.

But I find a problem.

For example:

When I import images from folder named "A", then I delete an image.

Then I import other image (name as same as the deleted image), the thumbnail in

IKImageBrowser will not change.

How could I resolve this problem?? Thanks!

Video display: http://www.youtube.com/watch?v=f3Jue9wOdUI


回答1:


Update: Wow, old post. Looks like the documentation was updated a while after I had posted; as the other answers suggest, looks like you need to increment the image's imageVersion to update an image from cache.


After mulling over the problem for close to three hours (once I started, it was really bugging me, too!), I came to the sad conclusion that it's a bug in how IKImageKit handles images. IKImageBrowserView has a cache of images and thumbnails, and from whatever experimental data I have, I'm guessing that it just caches its images based on location on disk, and not on image data (so it can load the data lazily, I guess), so even if the actual image data can change, reloading the same file location will not update the image itself.

Of course, I could be completely wrong - which wouldn't surprise me, since there's literally no documentation on the issue, so I have nothing but results from Instruments and the app itself to guide me - but my advice to you is to ignore the issue for now, since there's nothing you can do about it, and possibly file the bug with Apple.

Of course, if anyone can introduce other evidence about this, please do! I'd love to know more about it.
Good luck!




回答2:


I came across a reference that said the internal cache IKImageBrowserView uses looks up thumbnails by ImageUID. So if you change the ImageUID that your data source returns to be something other than just file name (maybe file name + file size), then it will be treated as a different image.




回答3:


You should take a look at the IKImageBrowserItem Protocol's imageVersion method. If you need to let IKImageBrowserView know that a item has changed its image you can increment the imageVersion. This will force the view to update the cached image.




回答4:


you should want to imageVersion update or name the image of the path. if you delete image with name "1.png" after you put image if it's name "1.png" the image browser view show the previous image so you should take care of image naming. or imageVersion method.



来源:https://stackoverflow.com/questions/3597287/ikimagebrowserview-thumbnail-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!