iphone - 更改所选单元格的背景颜色?

标签 iphone uitableview colors background tableview

有谁知道如何使用 UITableViewCell 更改每个选定单元格的背景颜色?我在 TableView 的代码中创建了这个 UITableViewCell。

最佳答案

更改属性 selectedBackgroundView 是正确且最简单的方法。我使用以下代码来更改选择颜色:

// set selection color
UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
myBackView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:0.75 alpha:1];
cell.selectedBackgroundView = myBackView;
[myBackView release];

关于iphone - 更改所选单元格的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2418189/

相关文章:

ios - 更改 UISearchBar 的键盘颜色

ios - 获取视频资源的尺寸

iphone - XCode for iOS 的编译/运行时间非常慢

ios - 为什么 cellForRowAtIndex 根本不运行?

ios - 具有复杂格式的 UITableViewCell 的最佳方法

java - 在 OpenCV (Java) 中获取正确的 HSV 颜色 inRange

ios - 设备方向未获取。

iphone - 使用UINib时看不到

ios - 在 Swift 3 中的 UITableView 中添加图像作为附件

AngularJS:根据条件ng-grid更改单元格的颜色