вы должны использовать правильную версию 28.0.0, просто нажмите alt-enter, чтобы получить предложения, и вы получите: реализацию 'com.android.support:cardview-v7:28.0.0'
внедрение' com.android.support:recyclerview-v7:28.0.0'
и ваша ошибка будет исправлена.
Установите для свойства ячейки таблицы selectionStyle
значение UITableViewCellSelectionStyleNone
. Это должно предотвратить выделение, и вы также можете проверить это свойство в вашем tableView: didSelectRowAtIndexPath:
.
Apple says that the first thing you should do in didSelectRowAtIndexPath is to deselect the row
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:NO];
Then you can change the AccessoryType to be a checkmark, or none, etc. So when you enter didSelectRowAtIndexPath you could deselect the row, and if its not meant to be selected, simply don't check that row.
To completely prevent selection of the UITableViewCell
, have your UITableViewDelegate
implement tableView:willSelectRowAtIndexPath:
. From that method you can return nil
if you do not want the row to be selected.
- (NSIndexPath *)tableView:(UITableView *)tv willSelectRowAtIndexPath:(NSIndexPath *)path
{
// Determine if row is selectable based on the NSIndexPath.
if (rowIsSelectable) {
return path;
}
return nil;
}
This prevents the row from being selected and tableView:didSelectRowAtIndexPath:
from being called. Note, however, that this does not prevent the row from being highlighted.
If you would like to prevent the row from being visually highlighted on touch, you can ensure that the cell's selectionStyle
is set to UITableViewCellSelectionStyleNone
, or preferably you can have your UITableViewDelegate
implement tableView:shouldHighlightRowAtIndexPath:
as follows:
- (BOOL)tableView:(UITableView *)tv shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath
{
// Determine if row is selectable based on the NSIndexPath.
return rowIsSelectable;
}
Эта проблема тоже перепробовала все, что уже упоминалось. Последний трюк, который помог избавиться от "синей вспышки" при выборе ячейки таблицы, заключался в добавлении этой строки:
self.myTableView.allowsSelection = NO;
Не уверен, была ли это одна строка или все вместе, но в качестве общего итога я больше не получаю ни выбора синего цвета, ни даже синей вспышки. Счастливо!
используйте это:
cell.selectionStyle = UITableViewCellSelectionStyleNone;