Day 20: -collapseAllGroups
Today I’ll take another break from the current drawing series and highlight something from ImageKit instead. As most of you’ll know, Apple introduced ImagKit in 10.5 and the most commonly used class is probably the IKImageBrowserView. It’s incredibly fast and very flexible but suffered from some nasty bugs in 10.5. For example, Apple had forgotten to implement a few important methods related to groups that the documentation listed as being there. Quite inconvenient.
In 10.6 I believe this got fixed. We can now properly collapse or expand individual groups. By default however when you load an IKImageBrowserView it has all its groups expanded. This may not be what you want. Now you can go ahead and collapse all groups yourself using the provided methods but you’re warned; this is quite slow and if you have a lot of items and groups in there and you’re running 10.6, you might want to call this method:
- (void)collapseAllGroups
It’s not listed in the documentation, but if you do a class-dump you’ll find it here. It’s not there in 10.5 though so you’ll either have to go 10.6 only or revert back to a slower one-by-one collapse of all groups. And while I’m talking about IKImageBrowserView, don’t forget to call -reloadData yourself because, unlike NSTableView etc, it doesn’t automatically load itself up even when the delegate and datasource are set in Interface Builder.