Tag: uicollectionviewcell

UICollectionView并使用Parse推送到detailViewController

我使用tapGesture方法将图像从UICollectionView包装到detailViewController viewController.h中,如下所示: #import <Parse/Parse.h> @interface CardsViewController : UIViewController <UICollectionViewDelegateFlowLayout> { NSMutableArray *allImages; NSArray *cardFileArray; } @property (weak, nonatomic) IBOutlet UICollectionView *imageCollection 和viewController.m如下 – (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } – (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return [cardFileArray count]; } – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifier = @"MyCell"; Cards *cell = (Cards *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier […]

在UITableViewCell和UICollectionViewCell之间共享代码

我有一个相当大的UITableViewCell子类,它处理各种手势和统计行为。 我也build立一个UICollectionView,我的UICollectionViewCell子类的行为是非常接近我的UITableViewCell。 我已经粘贴了很多代码。 我的问题是:是否有一个devise模式,可以让我有这两个子类之间共享的UI代码(手势和状态)? 我听说过构图模式,但我很难适应这种情况。 这是正确的使用模式吗? 注意:我必须保持UITableView和UICollectionView,所以放弃UITableView不是一个解决scheme。

用附加控件注释UICollectionViewselect的devise

使用UICollectionView和在这里给出的StackOverflow的优秀帮助,我已经能够为我的iPhone构build一个“甘特图”风格控制: 除了化妆品(我现在正在做function,我有一个graphicsdevise师可以看看颜色和所有这些)。 除了背景之外,使用自定义UICollectionViewLayout子类的跨度相对比较简单。 每个跨度是一个item 。 但是我需要添加一些function,并且不确定如何继续。 我试图去的地方大致如下: 撇开粗略的化妆品,重点是我想“注释”,无论目前select的跨度与额外的信息(我保证找人帮我看起来很漂亮)。 而且我希望它们是活跃的,我不确定它是否会引起编辑控制或拖动,但是我希望能够识别数字或粗线上的手势,并且使用它们进行操作,与触摸不同驱动select的跨度。 我可以想到(至less)3种方式来尝试和实现这个: 使用补充意见。 导致selectinvalidateLayout ,在我的prepareLayout检测选中的状态,并为两个锚点生成额外的布局属性。 实现绘制UICollectionReusableView的子类,并添加可触摸的子视图(或其自己的手势识别器)。 这感觉…错了。 我认为补充视图更多的是页眉和页脚,而不是随着select状态的变化而出现的控件。 但也许这是该设施的适当扩展? 使用我当前的SpanCell类(它是UICollectionViewCell一个子类)的backgroundView (或selectedBackgroundView ,不知道它的问题)。 只要我禁用clipsToBounds ,我可以绘制围绕bounds的注释。 我将不得不透露一些大局的知识以find终点,但那不是太冒犯。 我只是显示/隐藏这个视图来响应select的改变。 这似乎是最好的办法。 在整个UICollectionView的主backgroundView中进行。 如图所示,我已经有了一个专门的backgroundView ,它显示了当前的时间网格,条forms。 我可以进一步扩展这个视图来绘制注释和pipe理可触摸的子控件来响应select的改变。 这会给我最直接的实现,但感觉就像一个巨大的怪物“为了背景做了太多的工作”。 问题是,对于那些有更多经验的人,你会走哪条路? 会不会是以上3个之一? 或者不同的东西? 为什么?

在Scrolling Filmstrip中的每个UICollectionViewCell中调用UIButton

这是对我以前的一个后续问题,这次我在每个UICollectionViewCell中添加了UIButton的问题。 在深入研究这个问题之前,让我把目前所有的情况都介绍给大家。 以下是我的UICollectionView在UITableView中的Scrolling Filmstrip样式的工作原理的基本概要: 用一个自定义的UITableViewCell创build一个普通的UITableView 创build一个将被添加到单元格的contentView的自定义UIView 自定义UIView将包含一个UICollectionView 自定义UIView将成为UICollectionView的数据源和委托,并pipe理UICollectionView的stream布局 使用自定义UICollectionViewCell来处理收集视图数据 使用NSNotification通知主控制器的UITableView何时已经select一个集合视图单元并加载详细视图。 到目前为止,我已经能够在每个UICollectionViewCell中添加UIButton,并且当我点击UIButton时,它的图像将变成勾选标记,但是当我向上/向下滚动时会出现问题。 一旦带有选中标记UIButton的单元格离开屏幕并再次在屏幕上滚动,UIButton图像就开始混乱了。 例如,当单元格1中的UIButton图像应该被选中标记但不是。 相反,选中标记会出现在另一个单元格中。 下面是我的相关代码: – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { PostsCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PostsCollectionViewCell" forIndexPath:indexPath]; NSDictionary *cellData = [self.collectionData objectAtIndex:[indexPath row]]; cell.postTextLabel.text = [cellData objectForKey:@"text"]; cell.locationNameLabel.text = [cellData objectForKey:@"locationName"]; // >>> Select Button <<< UIButton *selectButton = [UIButton buttonWithType:UIButtonTypeCustom]; [selectButton setFrame:CGRectMake(110, 150, […]

双击UICollectionViewCell上的手势?

我想双击UICollectionViewCell来像OkCupid App那样喜欢这个configuration文件。 我已经在集合视图上应用了Tap Gesture,但它不起作用。 当我尝试每次didSelectCollectionViewCell方法调用时双击单元格。

UICollectionView水平设置标题时应用程序崩溃

我在UICollectionView中很新。 我真的很难find解决办法。 我正在试图在3水平行中添加标题。 我正在使用集合视图stream布局。 这是我执行的代码: – (void)awakeFromNib { self.collectionView.backgroundColor = [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0]; self.collectionView.backgroundColor = [UIColor clearColor]; self.collectionView.backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; flowLayout.itemSize = CGSizeMake(130.0, 170.0); [self.collectionView setCollectionViewLayout:flowLayout]; // Register the colleciton cell [_collectionView registerNib:[UINib nibWithNibName:@"ORGArticleCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"ORGArticleCollectionViewCell"]; [self.collectionView registerClass:[_HeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView"]; } […]

文本模糊与UICOllectionview单元格

我有collectionView单元格中,我有这个文本,我想模糊图像中显示的文字。 我曾尝试使用UIVisualEffect,但我没有得到确切的答复。 代码: UIGraphicsBeginImageContext(self.bounds.size); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //Blur the UIImage with a CIFilter CIImage *imageToBlur = [CIImage imageWithCGImage:viewImage.CGImage]; CIFilter *gaussianBlurFilter = [CIFilter filterWithName: @"CIGaussianBlur"]; [gaussianBlurFilter setValue:imageToBlur forKey: @"inputImage"]; [gaussianBlurFilter setValue:[NSNumber numberWithFloat: 10] forKey: @"inputRadius"]; CIImage *resultImage = [gaussianBlurFilter valueForKey: @"outputImage"]; UIImage *endImage = [[UIImage alloc] initWithCIImage:resultImage]; //Place the UIImage in […]

在UITableView中的滚动Filmstrip中的每个UICollectionViewCell中添加UIButton

首先,让我描述一下迄今为止的情景。 以下是我的UICollectionView在UITableView中的Scrolling Filmstrip样式的工作原理的基本概要: 用一个自定义的UITableViewCell创build一个普通的UITableView 创build一个将被添加到单元格的contentView的自定义UIView 自定义UIView将包含一个UICollectionView 自定义UIView将成为UICollectionView的数据源和委托,并pipe理UICollectionView的stream布局 使用自定义UICollectionViewCell来处理收集视图数据 使用NSNotification通知主控制器的UITableView何时已经select一个集合视图单元并加载详细视图。 到目前为止,我已经能够创build上面描述的那些,但正如你可以在图片中看到的,我也想在每个UICollectionViewCell中添加一个UIButton,这样当我点击UIButton时,它的图像将会变成标记和数据在这个UICollectionViewCell将被保存到一个数组中。 最后,当我点击右上angular的三angular形button,它会推动到另一个视图与arrays,保存选定的数据传递。 这里是我所有的相关课程: UITableView的 ViewController.h ViewController.m 的UIView ContainerCellView.h ContainerCellView.m UICollectionViewCell CollectionViewCell.h CollectionViewCell.m 的UITableViewCell ContainerCell.h ContainerCell.m 我的问题是,我不能让我的UIButton至less显示(现在)下面的代码: ContainerCellView.m – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CollectionViewCell" forIndexPath:indexPath]; NSDictionary *cellData = [self.collectionData objectAtIndex:[indexPath row]]; … // >>> Select Button <<< UIButton *button = (UIButton […]

dynamic调整UICollectionViewCell的大小

我有一个UICollectionView与2 UILabel和UIImage具有类似的布局: ——————– | | | LABEL1 | | IMAGE | | LABEL2 | | …… | | …… | ——————– Label2有不同数量的线条,单元格不同,我希望能够根据label2 height自动调整UICollectionView height label2 height ,让它“自动填充”单元格。 是否有可能在iOS?

UICollection View在较小的设备上导致“UICollectionViewFlowLayoutBreakForInvalidSizes”

在iPhone 6 Plus上,收集视图单元格很好,但是当在另一个像iPhone 5的设备上testing时,我被“ 017-06-15 01:59:25.744 HyperTest [3865:8825385] UICollectionViewFlowLayout的行为未定义,因为:2017-06-15 01:59:25.744 HyperTest [3865:8825385]项目宽度必须小于UICollectionView的宽度减去左侧和右侧的值,减去内容左右值。 2017-06-15 01:59:25.745 HyperTest [3865:8825385]相关的UICollectionViewFlowLayout实例是,它被连接到; 层=; contentOffset:{0,0}; contentSize:{414,219}>集合视图布局:。 2017-06-15 01:59:25.745 HyperTest [3865:8825385]在UICollectionViewFlowLayoutBreakForInvalidSizes中创build一个符号断点,以便在debugging器中捕获这个断点。 特别是当我这样做: let layout = billFeedCollectionView.collectionViewLayout as? UICollectionViewFlowLayout // casting is required because UICollectionViewLayout doesn't offer header pin. It's feature of UICollectionViewFlowLayout layout?.sectionHeadersPinToVisibleBounds = true layout?.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize 反正我可以解决这个问题? 我需要确保细胞适应所有设备。