Powering the Circle Layout

This recipe makes a number of changes to Apple’s original sample. For one thing, Recipe 10-6 uses Add and Delete bar buttons rather than gestures. For another, each view is distinct and identifiable by its color. Instead of deleting “any item” or adding “some item,” Recipe 10-6 uses selections. The user chooses an item to focus on. That selection controls which item is deleted (the selected item) or where new items should be added (just after the selected item).

The following deletion code retrieves the currently selected item, deletes it, and selects the next item. Then it enables or disables the Add and Delete buttons, depending on how many items are currently onscreen:

- (void)delete ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.