Вот как настроены мои ячейки:
- (UITableViewCell *)tableView:(UITableView *)tableViewIn cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"subcategory";
UITableViewCell *cell = [tableViewIn dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [[subcategories objectAtIndex:indexPath.row] title];
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.contentView.backgroundColor = [UIColor clearColor];
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.highlightedTextColor = [UIColor whiteColor];
return cell;
}
Как видите, я установил фон contentView
, и это отлично работает, но когда я пытаюсь сделать то же самое вещь с backgroundView
или accessoryView
, ничего не происходит, потому что backgroundView
и accessoryView
кажутся равными нулю.
Когда задают accessoryType
, а не accessoryView
, как тогда установить фон для аксессуара?