Circular (fan-shaped) layout with UICollectionView

XFCyclicAnnularFlowLayout

CollectionView implements fan-shaped (ring) layout

 

Function settings

  • 1. Set how many layers of sector (ring)

  • 2. Set how many elements the layer has

  • 3. Set the element size Size

  • 4. Set the radius around which the layer wraps

  • 5. Set the expansion arc of the fan shape of this layer

  • 6. Set the orientation of all elements

    • face up (default)
    • face down
    • Inward (head towards the center of the circle)
    • Outward (the head is in the same direction as the ring normal)
  • 7. Set whether all elements in the ring of this layer are arranged clockwise

    • The default is clockwise

API description

  • Sector (ring) radius of the current group

    • -(CGFloat)flowLayout:(XFCyclicAnnularFlowLayout*)flowLayout cyclicAnnularRadiusInSection:(NSInteger)section;

    • The return parameter type value description is as follows:

        CGFloat 返回当前组扇形(环形)的半径 (单位: π)
      
  • The size of the current position Cell (size )

    • -(CGSize)flowLayout:(XFCyclicAnnularFlowLayout *)flowLayout cyclicAnnularItemSizeAtindexPath:(NSIndexPath *)indexPath;

    • The return parameter type value description is as follows:

        CGSize  返回当前位置(indexPath)cell的大小
      
  • The current group's range in radians (that is, the group is expanded in radians)

    • -(CGFloat)flowLayout:(XFCyclicAnnularFlowLayout*)flowLayout cyclicAnnularRadianInSection:(NSInteger)section;

    • The return parameter type value description is as follows:

        CGFloat  返回当前组元素在视图上展开的弧度范围
      
  • Whether the group of elements expands clockwise in the fan-shaped area

    • -(BOOL)flowLayout:(XFCyclicAnnularFlowLayout*)flowLayout cyclicIsClockwiseInSection:(NSInteger)section;

    • The return parameter type value description is as follows:

        BOOL  该返回值设定视图当前环形中cell是顺时针依次排列,还是逆时针依次排列,默认是顺时针
      
  • element orientation

    • -(XFCyclicAnnularItemOrientation)cyclicAnnularItemOrientationInFlowLayout:(XFCyclicAnnularFlowLayout *)flowLyout;

    • The return parameter type value description is as follows:

        typedef NS_ENUM(NSUInteger, XFCyclicAnnularItemOrientation) {
        	XFCyclicAnnularItemOrientationUp,           // 朝上 默认
        	XFCyclicAnnularItemOrientationDown,         // 朝下
        	XFCyclicAnnularItemOrientationInside,       // 朝内
        	XFCyclicAnnularItemOrientationOutside       // 朝外
        };

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325156308&siteId=291194637