UICollectionView を使用し、セルを使用して値を関連付けるラベルを配置しました。セルを接続すると、テキストを選択したラベルに取り、それを使用して他のことをしたいと思います。どのようにできるのか?
このコードでは、インデックスに正確に戻ることができますが、セルの内容を取得して文字列に入れることはできません。
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = @"Cell";
CustomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
NSString *strColorCell = cell.lblCustomCell.text;
NSLog(@"Indice della cella: %i %i %@", indexPath.item, indexPath.section * 2 + indexPath.row, strColorCell);
}