【发布时间】:2017-07-05 07:49:30
【问题描述】:
我的UICollectionView 有一个奇怪的行为。有时didSelectItemAtIndexPath: 没有被调用。但是,如果我选择另一个项目并且他们可以单击上一个项目。
- 代表们没事。
- 手势识别器被禁用
-
UICollectionView在前面。在此之前什么都没有
我的代码:
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
if (self.activeCollectionViewObjects.count > section) {
NSArray *array = self.activeCollectionViewObjects[section];
return array.count;
}
}
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
VenueLayoutCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kVenueLayoutCellReuseIdentifier forIndexPath:indexPath];
self.activeCollectionViewCellsDictionary[indexPath] = cell;
if (self.activeCollectionViewObjects.count > indexPath.section) {
NSArray *rows = self.activeCollectionViewObjects[indexPath.section];
if (rows.count > indexPath.row) {
if ([rows[indexPath.row] isKindOfClass:[VenueLayoutCellObject class]]) {
VenueLayoutCellObject *object = rows[indexPath.row];
cell.cellObject = object;
}
}
}
[cell layoutIfNeeded];
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"hello");
}
我哪里错了?提前致谢
手势识别器现在已禁用。我已经设置了断点,他们不雇用
【问题讨论】:
-
没有真正的代码是无法分辨的...
-
如果你解决了请贴出答案
标签: objective-c uicollectionview didselectrowatindexpath