我的自定义 UITableViewCell DayOfWeekTableViewCell
显示一些奇怪的行为 as you can see here.
我试图通过将以下行添加到我的 DayOfWeekTableViewCell
类中来修复它
class DayOfWeekTableViewCell: UITableViewCell {
@IBOutlet weak var dayOfWeek: UILabel!
@IBOutlet weak var totalAmountSpent: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
//Added these lines
let colorView = UIView()
colorView.backgroundColor = UIColor.clearColor()
UITableViewCell.appearance().selectedBackgroundView = colorView
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
但现在我的应用程序的行为类似于 this .我只是希望单元格在我选择它时看起来一样,而不是被一些矩形 Blob 覆盖。
如有任何帮助,我们将不胜感激!
最佳答案
cell.selectionStyle = UITableViewCellSelectionStyleNone;
将解决您的问题。我不知道它在 swift 上会是什么样子,所以只需将它发布在 objective-c 中即可。祝你好运。
关于ios - 选择时自定义 UITableViewCell 更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34671286/