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