如何让UITableView中的单元格变蓝?

Jac*_*e11 16 iphone objective-c uitableview

我正在使用UITableView,我在这个视图中使用的单元格在单击时不应该执行任何操作.我无法关闭UserInteraction,因为那时我无法点击附件(detailDisclosureButton).那么我怎样才能让它们停止变蓝并仍允许它们点击配件?

小智 18

默认情况下,selectionStyle单元格的属性为UITableViewCellSelectionStyleBlue.将其更改为UITableViewCellSelectionStyleNone.


Joh*_*ker 10

当您生成UITableViewCell(在UITableView的- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath方法调用中)时,只需将selectionStyle属性设置为UITableViewCellSelectionStyleNone.

设置UITableViewCell类参考以获取更多信息.


Jha*_*iya 6

使用UITabelViewCell selectionStyle属性.

myCell.selectionStyle = UITableViewCellSelectionStyleNone;
Run Code Online (Sandbox Code Playgroud)