Tag: uicollectionview

独立滚动UICollectionView的每个部分?

是否有可能使用UICollectionViewbuild立一个布局,每个部分可以独立滚动? 例如,设想20行图像,其中每行可以独立水平滚动以显示更多的图像(不滚动过程中的其他行)。 整个视图可以垂直滚动显示更多的行。 我相信像这样的东西可以用一个UIScrollView内的多个UICollectionView实例来实现; 然而,利用UICollectionView来插入/移动部分会很好。 我怀疑这是不实际的,因为UICollectionView是UIScrollView的子类; 但也许这可以用自定义的UICollectionViewLayout来完成?

UIVollectionView与UIViewController作为数据源

我有一个第一个键作为图像的字典数组。 我使用UIViewController作为数据源。 @interface myViewController () { NSMutableArray *textureArray1; NSMutableDictionary *dict1; UIImage *key1a; // UIImage NSString *key1b; // texture name } 我没有麻烦填充这个字典数组与UIViewController中摆放的TableView控件。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } UIImage *image = [[textureArray1 objectAtIndex:indexPath.row] […]

图像不在PFQueryCollectionViewController中显示

我正在开发一个iPhone应用程序,该应用程序应该在UICollectionView显示图像。 图像保存在Parse云中,我使用PFQueryCollectionViewController的子类来查询和显示图像。 点击一个MKMapView标注会触发显示CollectionViewController的segue。 第一次显示CollectionViewController时,图像不会出现在单元格中。 但是,如果我回到MapView ,然后返回到CollectionViewController ,图像出现在单元格中。 如何在第一次显示PFQueryCollectionViewController时显示图像? 这是我的代码: class PhotoGridCollectionViewController: PFQueryCollectionViewController { override func viewDidAppear(animated: Bool) { } override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: UICollectionViewDataSource override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { //#warning Incomplete method implementation — […]

如何在故事板中使用UICollectionViewController,同时支持ios 5.1?

检测特定function类是否存在并根据可用性降低用户function是最佳做法。 我在storyboard中创build了UICollectionView,并创build了一个标准的tableview来支持ios 5.1用户。 然后,我只是检查用户是否有这个function,并继续适当的场景。 然而,当我现在尝试编译我的代码,我得到一个“dyld:符号未find:_UICollectionElementKindSectionHeader”这似乎是非常反模式的苹果,不允许故事板ios6.0function与ios 5.1部署目标。 if ([UICollectionView class]) { [self performSegueWithIdentifier:@"UserShow" sender:self]; } else { [self performSegueWithIdentifier:@"UserShowTable" sender:self]; } 以上对我来说似乎是一个相当合理的方法…

ios:将新数据加载到UICollectionView

我想做一个应用程序,将图像显示到UICollectionView。 图像将从服务器下载,然后显示为collectionView。 我正在使用自定义collectionView布局到xib文件。 一次,从服务器接收20个图像。 问题:我无法将新下载的图像显示到collectionView中。 这是我的代码: -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { BOOL reloaded = NO; static NSString *cellIdentifier = @"cvCell"; CVCell *cell = (CVCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath]; NSMutableArray *data = [self.dataArray objectAtIndex:indexPath.section]; NSString *cellData = [data objectAtIndex:indexPath.row]; dispatch_queue_t queue = dispatch_queue_create("com.justTest.anotherSingleApplication", NULL); dispatch_async(queue, ^{ //code to be executed in the background NSString *imageName1 = […]

UICollectionViewFlowLayout的严重错误:水平滚动模式下的minimumInteritemSpacing和minimumLineSpacing

我在水平滚动模式 ( iOS 8 , iOS 7 ,我testing过的唯一一个)中面对以下UICollectionView错误。 我的问题 我想就这个错误以及如何优雅地解决这个问题发表看法。 设置 UICollectionViewFlowLayout * layout ; layout = [[UICollectionViewFlowLayout alloc] init] ; layout.scrollDirection = UICollectionViewScrollDirectionHorizontal ; layout.minimumInteritemSpacing = 5 ; layout.minimumLineSpacing = 100 ; 错误 这是很难解释,但我会尽我所能。 当UICollectionView中的单元格不具有相同的大小时,会发生该错误。 当所有的细胞有相同的大小,看起来像这样 但只要其中一个单元的大小与其他单元的大小不同,就像这样 所以,它似乎交换了minimumInteritemSpacing和minimumLineSpacing 。 链接到一个最小的非工作示例 https://github.com/colasjojo/TEST_COLLECTION_VIEW_BUG 更多的代码 #import "ViewController.h" #import "MyCell.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UIView […]

iOS UICollectionView里面的UITableViewCell

我想实现一个包含几个图像的列表,如下面的模型一样。 每个部分显示的图像数量是dynamic的,可能会有所不同。 我也在一个部分的所有图像始终可见(无需水平或垂直滚动​​)。 什么是最好的方法来实现这一目标? 我正在使用UITableViewCell里面的UICollectionView做一些testing,但是我不能让UICollectionView / UITableViewCell的大小根据里面的图片数量自动扩展。 是UICollectionView / UITableViewCell的路要走还是有一个更简单的方法?

Swift:UICollectionViewCell didSelectItemAtIndexPath更改backgroundColor

我很容易能够在CellForItemAtIndexPath方法中更改单元格的背景颜色 func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { cell.backgroundColor = UIColor.blackColor() } 但是,当我尝试更改DidSelectItemAtIndexPath中的颜色不起作用。 func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { let cell: ButtonCollectionCell = collectionView.dequeueReusableCellWithReuseIdentifier("ButtonCell", forIndexPath: indexPath) as! ButtonCollectionCell { cell.backgroundColor = UIColor.blackColor() } 另外我读的地方,使用didSelectItemAtIndexPath将无法正常工作,因为一旦集合视图开始滚动颜色将改变 什么是在Swift修复? 非常感谢你的帮助

UICollectionView与分页启用

我必须像Appstore iOS应用程序一样创build网格视图。 我想用UICollectionView分页来做到这一点。 我也实现了代码,但不能像这样滚动。 我想要做的是在中心和左右两边都会有一个图像,它应该显示上一张和下一张图像的一部分。 我为UICollectionView设置了Frame为320 * 320。 单元尺寸为290 * 320(单元最小间距为10) 以下是描述我的要求的两个链接。 提前致谢。 (这是我想要的) 2

UICollectionView无限滚动?

我试图实现无限滚动行为的集合视图。 滚动应该是圆形的 – 就像在UIPickerView 。 可以用苹果的UICollectionView来完成,还是别无select,只能创build一个水平的PickerView? 你怎么看?