ios - 如何使用 objective-C 在 TableView 中突出显示多行

标签 ios objective-c uitableview

如果我触摸第一行,它将突出显示。如果我触摸第二行,则第一行不会突出显示,第二行会在 iOS 的表格 View 中突出显示。 我想突出显示(多个)两行

Here is my Code

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

UIView *selectionColor = [[UIView alloc] init];
selectionColor.backgroundColor = [UIColor grayColor];
cell.selectedBackgroundView = selectionColor;

}

最佳答案

使用

self.tableView.allowsMultipleSelection = YES;

UITableView 的属性。

关于ios - 如何使用 objective-C 在 TableView 中突出显示多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32310758/

相关文章:

java - 如何在 Java 中解密 Obj-c 中加密的数据

ios - UITableView:在顶部添加单元格时保持选择(单选)?

iphone - iOS 会在后台杀死应用程序吗?

ios - 通过导航 Controller 使用自定义动画转换到 SecondViewController 中的非事件 View 后

ios - 表情符号支持 NSAttributedString 属性(字距调整/段落样式)

c# - AppInitializer 始终启动 android 进行跨平台测试

objective-c - 如何在 iOS 上注入(inject)用户脚本?

objective-c - NSButton 在 NSImageView 上显示时出现渲染问题

ios - 当一个 Label adjustFontSizeToFitWidth 时,在 UITableViewCell 的 UILabels 上设置匹配的字体大小

ios - 更改 UIViewTableCell 样式不起作用