我在我的UITableviewCell中使用了UICollectionView,一切正常,仍在加載集合視圖並顯示其單元格,但加載集合視圖後,我無法獲取「didSelectItemAtIndexPath 「點擊集合視圖單元格時的集合視圖的委託方法。當在UITableviewCell中使用UICollection視圖時不調用UICollectionView委託方法「didSelectItemAtIndexPath」
有靜態細胞和我把收集鑑於該小區
而且其上定義
這裏的委託和數據源我的表視圖是我叫,但委職能不叫代碼,數據源方法
collectioview和委託和數據源的#pragma mark - collectionView data source
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 10;
}
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"collCell" forIndexPath:indexPath];
UIImageView *imgDocCell = (UIImageView *)[cell viewWithTag:100];
imgDocCell.image = self.imgFileToChart;
cell.layer.borderWidth=1.0f;
cell.layer.borderColor=commonThemeColor.CGColor;
return cell;
}
#pragma mark - collectionView delegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"%@",indexPath);
}
'collectionView data source' code added where? –
我認爲它採取tableview委託方法。將斷點放在tableview委託方法中,並檢查它 –
@ Mr.Bista在我的tableview控制器 –