Использовать синий фон по умолчанию, когда выбран UITableViewCell - PullRequest
1 голос
/ 07 июня 2011

Для удобства пользователей я бы хотел, чтобы у моего UITableViewCell был синий стиль по умолчанию, когда пользователь нажимает на него.В настоящее время нет стайлинга вообще.Разве это не все, что мне нужно?

- (void)tableView:(UITableView *)tableView 
    didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{   
    [tableView selectRowAtIndexPath:indexPath 
        animated:NO scrollPosition:UITableViewScrollPositionNone];
    // [The rest of my code here 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;
}

1 Ответ

2 голосов
/ 07 июня 2011

Перейти к cellForRowAtIndexPath и использовать

cell.selectionStyle= UITableViewCellSelectionStyleBlue;
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...