#pragma mark -- 主要实现在于自定义UICollectionViewFlowLayout
#pragma mark - SSGiftCollectionViewFlowLayout.h文件
#import <UIKit/UIKit.h>
@protocol CustomViewFlowLayoutDelegate <UICollectionViewDelegateFlowLayout>
- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout cellCenteredAtIndexPath:(NSIndexPath *)indexPath page:(int)page;
@end
@interface SSGiftCollectionViewFlowLayout : UICollectionViewFlowLayout
@property (nonatomic, weak) id<CustomViewFlowLayoutDelegate> delegate;
@end
#pragma mark - SSGiftCollectionViewFlowLayout.m文件
@implementation SSGiftCollectionViewFlowLayout
- (void)prepareLayout{

本文介绍了如何通过自定义UICollectionViewFlowLayout来实现分页浏览的效果,关键在于代理方法的实现,通过对可见区域的判断来更新UIPageControl的当前页数。

2664

被折叠的 条评论
为什么被折叠?



