使用UICollectionView自动滚动

时间:2013-09-06 03:12:08

标签: ios uicollectionview

- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView        cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    SliderCollectionViewCell *cell = [collectionView    dequeueReusableCellWithReuseIdentifier:@"articleCellslider" forIndexPath:indexPath];
    NSDictionary *item = [_articleListslider objectAtIndex:indexPath.item];

   // set the article image
    [cell.image setImageWithURL:[item objectForKey:@"image"]];

  // set the text of title UILabel
    cell.title.text = [NSString stringWithFormat:@"%@\n\n\n\n", [item objectForKey:@"title"]];
    cell.title.textColor = [UIColor colorWithRed:33.0f/255.0f green:74.0f/255.0f blue:146.0f/255.0f alpha:1.0f];

    // set the text of summary UILabel
    cell.description.text = [NSString stringWithFormat:@"%@\n\n\n\n\n\n\n\n\n", [item objectForKey:@"description"]];
        cell.description.font = [UIFont fontWithName:@"Helvetica Neue" size:14];

    cell.targetURL = [item objectForKey:@"link"];
    cell.sliderphoto = [item objectForKey:@"sliderphoto"];
    cell.date.text = [NSString stringWithFormat:@"%@\n\n\n\n", [item objectForKey:@"pubDate"]];
    cell.category.text = [NSString stringWithFormat:@"%@\n\n\n\n", [item objectForKey:@"category"]];
    return cell;

}

我的目的是让此集合视图中的项目自动水平滚动。

如何使用此设置为我的集合视图自动滚动?

1 个答案:

答案 0 :(得分:1)

查看 iCarousel 。它很容易集成并解决您的问题。