- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我想隐藏按钮,只要它的标题等于“str”变量即可。
我无法添加更多照片,但它对“7:00”、“12:00”、“17:00”、“22:00”值做同样的事情。只想要“2:00”并为此进行比较。
这是 (collectionView)cellForItemAtIndexPath 错误还是其他什么?我很困惑。请帮助..
最佳答案
当您滚动时,它将重新使用该单元格,因此您可以根据条件设置 hidden true false。我认为这是你的问题。
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let hour = array[indexPath.row]
let str ="2:00"
if(cell.hourBtn.titleLabel?.text ==str {
cell.hourBtn.hidden = true
}
else {
cell.hourBtn.hidden = false
}
}
关于Swift UICollectionView cellForItemAtIndexPath 设置单元格内容不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38066501/
在快速滚动 Collection View 时,我需要动态调整 imagView 的大小... 我使用这个函数来获取滚动事件: func collectionView(collectionVi
我现在正在测试 UICollectionViewCell 中有一个变量...这是我的 cellforitem func collectionView(_ collectionView: UIColle
您能否假设 collectionView:cellForItemAtIndexPath: 何时会被调用?我有一个 UICollectionView,其中每个单元格的大小都与 Collection Vi
这些线上到底发生了什么 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemA
我有一个 UICollectionView,我将它添加到 Storyboard中的 UIViewController 中。 它包含 BookCell 类的 UICollectionViewCell 和
让我描述一下我的问题。 我写了一个名为 CardCell 的类,它继承自 UICollectionViewCell。 在我的另一个类 MainViewController 中,它是 UICollect
我有两个 Collection View 。它们都使用相同的单元格布局,但出于其他原因,它们必须是单独的 Controller 。目前,当我更新 cellForItemAtIndexPath: 时,我
我有一个 UICollectionView,它使用自定义 UICollectionViewCell 类。基本思想是 Collection View 将遍历目录并显示目录中包含的照片(通过 API 调用
我正在尝试从 View Controller 推送到 Collection View Controller 。 UICollectionViewLayout *collectionViewLayout
我有两个 UICollectionViews在我的UIViewController . 假设它们是 A 和 B,A 和 B 在 nib 文件中位于 UIViewcontroller 中的相同位置,它们
我在这个 cellForItemAtIndexPath:(NSIndexPath *)indexPath 上有问题 dispatch_async(dispatch_get_global_q
我读过其他一些关于此问题的问题,这些问题与 CollectionView 的大小有关。我已经尝试按照这些答案中的建议调整大小,但它们都不起作用。我正在使用 NSFetchedResultsContro
我正在构建一个包含大量要在 Collection View 中显示的大型图像文件的应用程序。由于图像的大小,我发现从它们的 URL 创建缩略图以及使用图像缓存要快得多。当我第一次使用 GCD 在 ce
我正在学习 Swift。我有 2 个问题。 完整来源是 here . 1.为什么collectionview(cellForItemAtIndexPath)会这样调用很多次? 编辑:我想知道的是为什么
我正在开发一个带有 UICollectionView 画廊的应用程序。我已将 UICollectionViewFlowLayout 子类化,并已启用 pageEnabled 属性。 我的图库处理图像非
我有一个 UICollectionView,其中每个单元格都是从 Flickr 异步填充的。 在我的场景中,我想要 21 个单元格,我的代码可以很好地生成它。但是,即使在 cellForItemAtI
enter image description here enter image description here 我想隐藏按钮,只要它的标题等于“str”变量即可。 我无法添加更多照片,但它对“7:
我一直想知道为什么我的代码在获取 Collection View 单元格时与 cellForItemAtIndexPath: 一起工作,而不与 dequeueReusableCellWithReuse
所以我正在尝试编写一些代码,将 Collection View 滚动到某个索引,然后提取对单元格的引用并执行一些逻辑。但是我注意到,如果该单元格在滚动之前当前不可见,则 cellForItemAtIn
我有一个更新现有 UICollectionView 的函数。UICollectionView 已创建,我可以看到它,但是当我想访问它的单元格以更新它时,它们为零。 -(void)finishExam{
我是一名优秀的程序员,十分优秀!