Как отключить выбор только одной ячейки в UITableView? У меня их несколько, и я хочу отключить только последнее.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = ...
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([self numberOfRowsInSection] == [indexPath row]) {
return nil;
} else {
return indexPath;
}
}
последняя строка таблицы не будет выбрана