1
我想设置UITableViewCell的焦点状态的颜色。问题是我注意到了单元格周围有一个奇怪的白色边框,所以我将tableview背景设置为黑色,并将焦点颜色设置为黑色,以检查是否确实如此,并且您可以在屏幕截图中看到,有一个细胞周围微弱的白色/灰色边框。有谁知道如何摆脱这个?设置UITableViewCell的焦点颜色
class MyCell: UITableViewCell {
override func awakeFromNib() {
backgroundView = nil
backgroundColor = UIColor.clear
}
override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
super.didUpdateFocus(in: context, with: coordinator)
if context.nextFocusedView === self {
coordinator.addCoordinatedAnimations({
self.contentView.backgroundColor = UIColor.black
}, completion: nil)
}
else {
coordinator.addCoordinatedAnimations({
self.contentView.backgroundColor = UIColor.clear
}, completion: nil)
}
}
下面的代码这并没有工作:(如果您看看第一个屏幕截图,你会看到灰色的焦点颜色,然后变成黑色,我认为这是事实突破。和“看起来”像一个边界。 – dubdub