While giving many designers a headache the Twitter app still serves as template on how to solve a variety of UX riddles. One of which is the situation where one might want to have sections in a tableview that possess the ability to expand from one row to several and collapse vice versa.
The eye of the experienced developer sees two challenges contained therein: 1) grafting a mechanism for collapsing and expanding onto UITableView in a reusable way 2) making custom accessory views that look like a rotated version of the disclosure indicator, pointing upwards or downwards and also changing color when highlighted.
In this article I present my solution to this UX riddle. At the same time I will demonstrate how NSMutableIndexSet can be used to our advantage. In contrast to the pull-to-reload method previously discussed, this does not contain anything remotely patentable.
Update March 12th, 2013: Cleaned up version of the custom-colored accessory is now available via DTFoundation, the example project is now part of our Examples collection on GitHub. Please note that if you use this code you have to attribute it to us or buy a Non-Attribution License.