SBIconList

From iPhone Development Wiki
Revision as of 03:31, 20 May 2010 by Chpwn (talk | contribs) (added infinicrap)
Jump to: navigation, search


SBIconList is a view containing one or several icons. Each page on the home screen is a different instance of SBIconList.

Notable Subclasses

Modifying the dimensions of SBIconList

The dimensions (max rows and columns) can be modified by hooking into the maxIconColumns and maxIconRows methods. The OS will attempt to space the icons according to default spacing, so adding a fifth column would cause the fifth column to wrap to the next row. Icon origins can be changed by hooking into originForIconAtX:Y:. The OS reuses icons to save on object allocations; as soon as a column is estimated as being off-screen, the icons get reused for the next column to appear onscreen. If the number of maximum columns goes over 5 (3.x) or 4 (2.x), you may notice flickering when switching pages.

  • Note: CategoriesSB and Infinicrap takes advantage of a quirk in the originForIconAtX:Y: where going beyond the bounds of the maximum columns/rows returns the value where such a row or column would be. Do not assume all calls to this method will be comprised within the max icon column/row bounds.

Edit mode & icon moving

Icon moving in edit/wiggle mode is not, contrary to expectations, related at all to where icons are located onscreen. If you have a 4x4 home screen but you play with the originForIconAtX:Y: values returned for each of these icons, you will notice that moving icons around will be exactly the same as it was before you changed their origins. Two methods, columnAtPoint: and rowAtPoint: estimate which column and row you are in according to the point passed in. Anyone wanting to make icon moving more natural for a modified layout would have to hook these methods accordingly.

SBIconList in Version 3.2

SBIconList had some pretty major changes in 3.2, now supporting rotation and such. You should note that the above info is completely useless as it uses a index-based system instead of one based on columns and rows.