CoderMJLee / MJRefresh

An easy way to use pull-to-refresh.
MIT License
13.79k stars 3.55k forks source link

UICollectionView Bug #169

Closed WenchaoD closed 9 years ago

WenchaoD commented 9 years ago

mjrefresh-uicollectionview

重现代码示例:

@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

WenchaoD commented 9 years ago

cell的间距和行间距都调成了0,也会这样

CoderMJLee commented 9 years ago

试试2.0版本?