Dev:SBIconView

SBIconView is a very versatile UIView subclass introduced in iOS 5 that is used to display icons in SpringBoard. In iOS 5 Apple split up icons into SBIcon (an abstract class) and SBIconView, introducing some degree of sanity with it. SBIconView conforms to the SBIconObserver protocol, and in turn exposes a protocol of its own: SBIconViewObserver. A lot of SpringBoard's home screen functionality can be modified by hooking the methods in SBIconView. One of the most magical methods in SBIconView is -setIcon:. It takes an instance of SBIcon and uses the information therein to create a semi-functional icon view.

Getting a home screen icon view
Generally, creating a new instance of SBIconView is not what you'd want. To manipulate the icon views in an SBIconListView, you need to use SBIconViewMap to get a specific instance of an icon view.

SBIconViewLocation
SBIconView uses an enum for its location property. There are 3 kinds of locations (these are not the names Apple uses): The location is used by SBIconView to decide what kind of shadow to use, badge text (handled by SBIcon's badgeTextForLocation:), and a few other things.

Ghosting
SBIconView also handles all the "ghosting" that is done when a folder or the switcher is opened. The way ghosting works is as follows: The last two calls in the above code place the ghostly image view under the current icon image view, and the main icon image view and badge (if one exists) are faded out. All methods for ghosting usually take an integer argument, requester. This is for the cases when the switcher is opened when there is already an open folder. Both the folder and switcher need the icon to be ghosted, and that's where the requester comes in. SBIconView uses requesters to keep track of how many clients have asked for it to be ghosted. In SpringBoard, there are only 2: folders (requester id 1) and the switcher (requester id 2). Use either one based on your needs.

Creating Modified Versions
The SBIconView class can be easily modified by subclassing.

These custom classes can be inserted into SpringBoard by hooking the following method in any class that conforms to the SBIconViewMapDelegate protocol: