0
私はこの質問をどこでも検索しましたが、これに対する正当な解決策は見つかりませんでした。 collectionview
の外にあるボタンをクリックすると、すべてのラベルの値にアクセスすることができます。collectionview
の外にはcollectionviewcell
というラベルが付いています。いつものようにボタンのクリックでテーブルビューの外にラベル値にアクセスするnullを返す
for (int h=0; h<detailArr.count; h++)
{
NSNumber * num = [totalProductArr objectAtIndex:h];
NSIndexPath * indexPath=[NSIndexPath indexPathForRow:[num intValue] inSection:0];
NSLog(@"indexpath text is %@", indexPath);
AppointmentContentCell *cell = (AppointmentContentCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
NSLog(@"text field text is %@", cell.serviceTypeLbl.text);
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
AppointmentContentCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
cell.serviceTypeLbl.text =[detailArr objectAtIndex:indexPath.row];
cell.serviceCostLbl.text = [costArr objectAtIndex:indexPath.row];
cell.totalServiceLbl.text = [totalServiceCount objectAtIndex:indexPath.row];
return cell;
}
細胞が再利用され、より便利である可能性があります。セルが画面上にない場合は、アクセスできません。セルにアクセスすることなく、基礎となるデータモデルからラベル値を得ることができるはずです – Paulw11
こんにちはPaulw11あなたはこれを詳しく説明します。それは私のために非常に役立つでしょう。 – ashish