如何使用CollectionView

时间:2016-03-01 11:40:55

标签: ios objective-c

enter image description here

我已使用CollectionView Controller创建此屏幕。

enter image description here

当我点击任何图像时,它会显示他们的图像。我使用Navigation controller创建并尝试了这个。

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    obj_NavigationViewController = [[NavigationViewController alloc] initWithNibName:@"NavigationViewController" bundle:nil];

    [self.navigationController pushViewController:obj_NavigationViewController animated:YES];

    obj_NavigationViewController.obj_String= [NSString stringWithFormat:@"%ld of %lu ",(long)indexPath.row,(unsigned long)[obj_Image count]];

    obj_NavigationViewController.obj_ImageCollection = [obj_Image objectAtIndex:indexPath.row];



}

现在它有效。但我想要的是,当我之后点击某个图像或滑动时,它应该显示另一个图像。但目前无法正常工作,请提出建议。感谢。

2 个答案:

答案 0 :(得分:0)

使用UIScrollView并根据图像数量计算内容大小或使用第三方库MWPhotoBrowser。

答案 1 :(得分:0)

我建议您使用Scrollview显示图像。正如@maulik Bhuptani建议的那样,MWPhotoBrowser是一个非常好的图书馆,可以满足您的需求。您可以通过展台方式实现功能。