Don';t对UITableViewCell使用默认焦点动画
我有一个非常简单的单元格,我希望文本在聚焦时为Don';t对UITableViewCell使用默认焦点动画,uitableview,focus,tvos,Uitableview,Focus,Tvos,我有一个非常简单的单元格,我希望文本在聚焦时为1.0alpha,在非聚焦时为0.5。这是通过覆盖didUpdateFocusInText import Foundation class SettingsTableViewCell: UITableViewCell { override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocu
1.0
alpha,在非聚焦时为0.5
。这是通过覆盖didUpdateFocusInText
import Foundation
class SettingsTableViewCell: UITableViewCell {
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
super.didUpdateFocusInContext(context, withAnimationCoordinator: coordinator)
var textColor:UIColor?
if self.focused == true {
textColor = UIColor.blackColor().colorWithAlphaComponent(1.0)
} else {
textColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
}
let attributedTitle = self.textLabel?.attributedText?.mutableCopy() as! NSMutableAttributedString
let range = NSMakeRange(0, attributedTitle.length)
attributedTitle.addAttribute(NSForegroundColorAttributeName, value: textColor!, range: range)
self.textLabel?.attributedText = attributedTitle
}
}
但是,我不希望在聚焦时出现白色背景。。。如何摆脱它
将单元格的
焦点样式设置为UITableViewCellFocusStyleCustom
和UIKit在单元格上根本不会显示任何默认焦点:这完全取决于您。将单元格的焦点样式设置为UITableViewCellFocusStyleCustom
和UIKit在单元格上根本不会显示任何默认焦点样式细胞:这完全取决于你