Does IKImageBrowserView support displaying a large number of animated GIFs?
I'd like to display a large number of animated GIF开发者_JAVA百科s in my application. But the GIF added to the IKImageBrowserView
is not animated. What can I do? Are there any alternative methods, such as NSTableView, WebKit? Which one is preferred?
I don't believe any built-in Cocoa method will display animated GIFs except WebKit. The problem is that you can't embed WebKit into IKImageBrowserView.
You could possibly use an NSCollectionView with its item views being WebKit views. I would worry about performance, though. Especially if there's a lot of animated GIFs, since NSCollectionView is not fast and not concurrent by itself. Instantiating hundreds or thousands of WebKits is probably also a bad idea.
Now, if you target 10.7 (Lion), you can also use NSTableView since in Lion you can use view-based cells instead of the pre-10.7 NSCell-based cells, which are not real views. So, with NSTableView you can again embed WebKit-based view as the cell. One benefit of this is improved performance since NSTableView only creates instances for the visible number of rows.
If you need to target 10.6 as well, there are a couple of open-source alternatives to NSCollectionView (BCCollectionView) and to view-based NSTableView (PXListView).
精彩评论