The Layout

Figure 10-8 shows the layout that Recipe 10-6 builds. As users add new items, the circle grows more crowded, up to a maximum count of 20 items on the iPad and 8 on the iPhone. You can easily modify these limits in the add and delete methods to match the view sizes for your particular application.

Recipe 10-6 Laying Out Views in a Circle

@implementation CircleLayout {     NSInteger numberOfItems;     CGPoint centerPoint;     CGFloat radius;     NSMutableArray *insertedIndexPaths;     NSMutableArray *deletedIndexPaths; } // Calculate and save off the current state - (void)prepareLayout {     [super prepareLayout];     CGSize size = self.collectionView.frame.size;     numberOfItems =         [self.collectionView ...

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.