UITableView
とカスタムセルを使用していcheckbox
ます。複数のセクションがあります。行 = 0 とセクション = 0 のセルなど、最初のセクションのチェックボックスをオンにすると、データが保存され、機能します。ただし、行 = 0 およびセクション = 1 のセルもチェックされます。これらのセクションの違いをどのように作ることができますか?
どうもありがとう!
UITableView
とカスタムセルを使用していcheckbox
ます。複数のセクションがあります。行 = 0 とセクション = 0 のセルなど、最初のセクションのチェックボックスをオンにすると、データが保存され、機能します。ただし、行 = 0 およびセクション = 1 のセルもチェックされます。これらのセクションの違いをどのように作ることができますか?
どうもありがとう!
次のサンプル コードは、状況に応じて役立ちます。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = (CustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = (CustomCell *) [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] objectAtIndex:0];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
cell.checkBox = [self fillCheckBoxStatus:indexPath];//This method will say about check box whether going to SET or NOTSET.
//...
return cell;
}
dequeueReusableCellWithIdentifier
ベローnil
... _
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil] autorelease];
////you another code..
}
return cell;
}