Closed WenchaoD closed 9 years ago
重现代码示例:
@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [_collectionView addLegendHeaderWithRefreshingBlock:^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [_collectionView.header endRefreshing]; }); }]; } - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return 2; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[NSString stringWithFormat:@"cell%@",@(indexPath.item)] forIndexPath:indexPath]; return cell; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return _collectionView.frame.size; } @end
IB中CollectionView在NavigationBar的下面,ViewController的autoAjdustScrollViewInset是反选的。CollectionView含两个Cell,其中Identifier分别是cell0和cell1。CollectionView的PageEnabled为YES
cell的间距和行间距都调成了0,也会这样
试试2.0版本?
重现代码示例:
IB中CollectionView在NavigationBar的下面,ViewController的autoAjdustScrollViewInset是反选的。CollectionView含两个Cell,其中Identifier分别是cell0和cell1。CollectionView的PageEnabled为YES