For a better user experience, I would like my UITableViewCell
to have the default blue styling when a user taps it. Currently, there is no styling at all. Shouldn't the following this be all I need?
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView selectRowAtIndexPath:indexPath
animated:NO scrollPosition:UITableViewScrollPositionNone];
// [The rest of my code here开发者_如何学Python that loads up the detail view]
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// [bunch of code]
UITableViewCell *cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:PlaceholderCellIdentifier] autorelease];
// [bunch of code that sets the text of the cell];
return cell;
}
Go to cellForRowAtIndexPath and use
cell.selectionStyle= UITableViewCellSelectionStyleBlue;
精彩评论