草庐IT

uicollectionviewcell

全部标签

ios - UICollectionViewCell 的 alpha 属性在重新加载后才生效?

如果我在cellForItemAtIndexPath中设置单元格的alpha属性如下...funccollectionView(collectionView:UICollectionView,cellForItemAtIndexPathindexPath:NSIndexPath)->UICollectionViewCell{letcell:UICollectionViewCell=collectionView.dequeueReusableCellWithReuseIdentifier("CGPathCell",forIndexPath:indexPath)asUICollection

ios - 如何在 didSelect 上向 UICollectionViewCell 添加边框并在选择另一个 UICollectionViewCell 时删除该边框?

例如,我有10个单元格的UICollectionView。我想为选定的单元格添加边框,稍后,在选择另一个单元格时,想要删除以前的边框并为新的选定单元格添加边框。我怎样才能做到这一点?我已经试过了:varselected=[NSIndexPath]()funccollectionView(collectionView:UICollectionView,didSelectItemAtIndexPathindexPath:NSIndexPath){self.imageView.image=applyFilter(self.colorCubeFilterFromLUT("\(self.LUTs

swift - 无法将 UICollectionViewCell 集中在 UITableViewCell 中

所以我正在探索新的tvOS。因为我想复制应用商店的水平功能部分(例如“最佳新应用”)我的计划是使用UITableView来布置基本结构(行),并为所有单独的水平滚动项目使用UICollectionView。不幸的是,tvOS始终关注UITableViewCell,而不是内部的UICollectionViewCell。我已经读过overridevarpreferredFocusedView:UIView?{returnaView}因此在我的Controller中使用它很难获得正确的subview。有什么我可以研究的,或者有人可以给我指明正确的方向吗?遍历所有subview直到我得到正确的

ios - 将容器 View 添加到 UICollectionViewCell

我正在尝试将容器View添加到界面生成器中的UICollectionViewCell,但Xcode发出错误error:IllegalConfiguration:ContainerViewscannotbeplacedinelementsthatarerepeatedatruntime.将UICollectionViewCell设为静态会解决这个问题吗?如果是这样,您将如何使UICollectionViewCell静态化? 最佳答案 我猜您正在尝试做的是将UIViewController放入动态生成的UITableViewCell中。

ios - UICollectionViewCell systemLayoutSizeFittingSize 返回不正确的宽度

我一直在玩弄动态UICollectionViewCell,并注意到在iOS8上调用cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize)在UICollectionViewCell上返回不正确的宽度。目前解决此问题的唯一解决方法是显式添加宽度约束以强制单元格的宽度。以下代码用于Cell子类:funccalculatePreferredHeightForFrame(frame:CGRect)->CGFloat{varnewFrame=frameself.frame=newFrameletwidt

ios - UICollectionViewCell 翻转并在点击时增长

如何实现带有翻转和增长以在点击时显示模态视图的UICollectionViewCell的动画? 最佳答案 这是我在另一个项目中使用的,效果很好:-(BOOL)collectionView:(UICollectionView*)collectionViewshouldSelectItemAtIndexPath:(NSIndexPath*)indexPath{UICollectionViewCell*cell=[collectionViewcellForItemAtIndexPath:indexPath];if(cell.selecte

objective-c - 如何找到 UICollectionViewCell 相对于应用程序窗口的坐标

是否可以将UICollectionViewCell的坐标从相对于UICollectionView转换为相对于superview?到目前为止,当触摸到superview时,我无法转换UICollectionViewCell的坐标。到目前为止,这是我尝试过的:-(void)collectionView:(UICollectionView*)collectionViewdidSelectItemAtIndexPath:(NSIndexPath*)indexPath{UICollectionViewCell*cell=[collectionViewdequeueReusableCellWith

iphone - iOS 子类 UICollectionViewCell 自定义初始化方法

我正在实现一个自定义的UICollectionViewCell,我想知道如何向它发送模型数据,以便该数据可用于初始化单元格的subview。我注册我的MyCollectionViewCell做..[self.collectionViewregisterClass:[MyCollectionViewCellclass]forCellWithReuseIdentifier:@"MyCell"];在下面的方法中,我做...-(UICollectionViewCell*)collectionView:(UICollectionView*)collectionViewcellForItemAtI

ios - 将 subview 添加到占据整个单元格框架的 UICollectionViewCell

我正在尝试简单地将UIView添加到占据整个单元格框架的UICollectionViewCell。我现在的代码只在左上角显示一个单元格(我怀疑每个单元格都在彼此重叠)。我到底该怎么做?我计划稍后对UIView进行子类化,以便自定义要添加到单元格的View。我不想将UICollectionViewCell子类化,但是基于我将使用它的方式。#pragmamark-Collectionviewdatasource-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView*)collectionView{return1;}-(N

ios - 如何使 UICollectionViewCell 适合其 subview (使用自动布局)

如何使用自动布局根据其subview的大小更改UICollectionViewCell的大小?我的UICollectionViewCell每个在它们的contentView中只有一个View。这是我的自定义UIView子类,它使用自动布局自动调整自身大小以适应其所有subview。它还正确实现了-intrinsicContentSize。然而UICollectionView,或者说它的布局,似乎并不关心这个。我正在使用UICollectionViewFlowLayout,并尝试:将itemSize保留为默认值。这为我提供了大小为50x50的单元格。实现委托(delegate)方法-co