UICollectionView无法向下滚动

时间:2016-02-07 16:11:18

标签: ios objective-c uicollectionviewcell

我在视图控制器中有uicollectionview。 我有 HomeCell它的UICollectionViewCell 我的UIView控制器是HomeController, 但是当我运行我的应用程序时,集合视图单元格不会滚动。

你可以帮我,我是一个使用Objective-C语言的新手。

这是我的HomeController.h代码:

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return arrayOfLyrics.count;
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    Lyrics *lyric = [[Lyrics alloc]init];
    lyric = [arrayOfLyrics objectAtIndex:indexPath.row];


    CellHome *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CellHome" forIndexPath:indexPath];
    cell.myTitle.text = lyric.title;
    cell.myArtis.text = lyric.artis;
    [cell.myImage setImage:[UIImage imageNamed:lyric.image]];

    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView
didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    _passLyric = [arrayOfLyrics objectAtIndex:indexPath.row];
    [self performSegueWithIdentifier:@"DetailView" sender:self];
}

0 个答案:

没有答案