Skip to content

awdigital/AWCollectionViewDialLayout

Repository files navigation

AWCollectionViewDialLayout

UICollectionViewLayout for displaying cells in a semi-circle with a nice fish eye effect.

Very handy for quickly browsing items with your left thumb without having some of the content hidden behind your finger while you scroll.

Demo Gif


####Initialize Layout

// Radius : The radius of your circle
// Angular spacing: Angle between items (deg)
// Cell Size: Size of your cell
// Alignment: Supports 2 Types: WHEELALIGNMENTLEFT and WHEELALIGNMENTCENTER
// X-Offset: To translate the circle along the x-axis

AWCollectionViewDialLayout *dialLayout = [[AWCollectionViewDialLayout alloc] initWithRadius:300.0  andAngularSpacing:18.0 andCellSize:CGSizeMake(240, 100) andAlignment:WHEELALIGNMENTCENTER andItemHeight:100  andXOffset:70];

####Enable Snap Mode

[dialLayout setShouldSnap:YES];

####Programmatically scroll to item at index

Use the cell_height variable you used to initialize the CollectionViewLayout and multiply it by the IndexPath.item

// Scroll to item at indexPath (0,2)
 [self.collectionView setContentOffset:CGPointMake(0, cell_height * 2) animated:YES];

Flip Horizontally

You can set the flip option to YES if you want to display your items on the right side of the CollectionView.

[dialLayout setShouldFlip:YES];

About

UICollectionViewLayout for displaying cells in a semi-circle with a nice fish eye effect

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published