Marker型のプロパティを持つcustomTableViewCellがあります。このオブジェクトを使用して、たとえばUILabelなどのUI要素をバインドします。
TableSectionオブジェクトがあります。これは基本的に、物事をより適切に管理するためにグループ化されたテーブルに使用します。次のようになります。
@interface TableSection : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) NSMutableArray *array;
私のcellForAtIndexPathメソッドでは、次のようにします。
TableSection *tableSection = [self.markersList objectAtIndex:indexPath.section];
Marker *m = (Marker *)[tableSection.array objectAtIndex:row];
cell.marker = m;
Webサービスから取得した情報にさらに情報がある場合は、このセルを更新したいと思います。
したがって、テーブルビューでオブジェクトのindexPathを取得し、次のことを試してみます。
- (void)updateIndexPath:(NSIndexPath *)indexPath marker:(Marker *)marker {
MarkerTableViewCell *cell = (MarkerTableViewCell *)[self.MarkersTableView cellForRowAtIndexPath:indexPath];
tableViewの最初のセクションでは、cell.marker
これが期待どおりです。ただし、他のセクションでcell.marker
はnilです。これには理由がありますか?ありがとう。