ios - 在表格 View 单元格中更改重新排序控件的颜色

标签 ios swift uitableview user-interface

在下图中,如何将 View 右侧按钮的颜色更改为白色?编辑:理想情况下只希望某些单元格为白色,其他单元格为黑色 这是我的代码:

cell.backgroundColor = .appOrange
cell.contentLabel.textColor = .white
cell.numberLabel.textColor = .white
cell.tintColor = .white //this appears to do nothing, just something I tried

enter image description here

最佳答案

在 iOS13.x 中,重新排序控件的颜色似乎取决于亮/暗模式(之前它被设置为与背景形成对比,现在它看起来是固定的,具体取决于模式)。 因此,可以通过 UITableViewCell 的 overrideUserInterfaceStyle 来切换重新排序控件的颜色。

默认 - 在手机的灯光模式下,我几乎看不到控件:

Default - in the light mode of the phone I get practically invisible controls

正在申请

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ...
    SelectableCell *cell = [tableView     dequeueReusableCellWithIdentifier:@"selectableCell"];
    ...
    cell.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;

   return cell;
}

给出如下结果:

Overriding - UI style

关于ios - 在表格 View 单元格中更改重新排序控件的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45967210/

相关文章:

iphone - 在哪里可以找到用于 iO 的 Boids 算法的一些开源实现?

ios - 有没有比使用 NSCoder 编码和解码所有内容更好的方法将自定义类保存到 NSUserDefaults?

ios - 如何将 CAShapeLayer 与父 View 对齐

ios - 从单元格中获取标签 - swift

iphone - 我如何在 TableView 的单元格中获取容器 UITableView

ios - 在 Swift 中点击页面控件时更改页面

ios - 通过 CLLocationManager 或 GoogleMap-IOS 跟踪用户行进的距离

ios - Swift 3 手势识别器 path.boundingBox 是无限的

ios - UITesting 命令行参数选项

ios - 如何在 UITableView 中自定义删除按钮