필자는 uitableview를 가지고 있지만 일부 셀을 비활성화하고 다른 셀을 활성화하려고합니다.uitableview의 특정 셀 변경
if ([indexPath row] > 0) {
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.userInteractionEnabled = NO;
cell.textLabel.textColor = [UIColor lightGrayColor];
}
하지만 그 대신 모든 셀을 비활성화하고 첫 가능, 그것은 불가능 모든 셀을 마지막 수 : 은 내가 cellForRowAtIndexPath
의 첫 번째를 제외한 모든 세포를 해제하려면 다음 코드를 사용했다. 왜 이런 일이 생길까요? 그리고 작동하도록하려면 어떻게해야합니까?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
sectionContents = [[self listOfItems] objectAtIndex:[indexPath section]];
contentsForThisRow = [sectionContents objectAtIndex:[indexPath row]];
if ([indexPath row] > 0) {
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.userInteractionEnabled = NO;
cell.textLabel.textColor = [UIColor lightGrayColor];
}
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = contentsForThisRow;
return cell;
}
'cellForRowAtIndexPath : – Nekto