I cannot get the right way to do the following stuff... (I m sure I m not that far but...) I have a UITableView and within this table I want a particuliar cell to be displayed as a button. At first I tried to add a button in the cell but I read that was not the right way to do it. Instead it seems better to customize the cell (and make it look like a button). The thing is, I do not really know what subview to change... What I need: - no arrow beeing displayed at the right of the cell (I though UITableViewCellAccessoryNone would do the trick... but it did not...). - the cell to be blue (same blue as the one used when it s clicked)
The following is the code I use:
NSString *section = (NSString *)[sections objectAtIndex:indexPath.section];
NSNumber *row = indexPath.row;
NSString *cellValue = (NSString *)[(NSArray *)[items objectForKey:section] objectAtIndex:row];
cell.textLabel.text = cellValue;
// Make Cell look like a button (used for disconnect option)
if([[sections objectAtIndex:indexPath.section] isEqualToString:@"connection"]) {
cell.textLabel.text = @"Disconnect";
cell.textLabel.textAlignment = UITextAlignmentCenter;
for (UIView* view in cell.contentView.subviews)
{
view.backgroundColor = [UIColor clearColor];
}
cell.accessoryType= UITableViewCellAccessoryNone;
}
感谢您的帮助,
页: 1