Avoid some non-objc features.

This commit is contained in:
WenchaoD 2017-03-09 14:29:19 +08:00
parent 27cc008a09
commit 8c649841ee
1 changed files with 13 additions and 5 deletions

View File

@ -60,18 +60,26 @@ open class FSPagerViewCell: UICollectionViewCell {
}
open override var isHighlighted: Bool {
didSet {
if self.isHighlighted {
set {
super.isHighlighted = newValue
if newValue {
self.selectedForegroundView?.layer.backgroundColor = self.selectionColor.cgColor
} else if !self.isSelected {
} else if !super.isSelected {
self.selectedForegroundView?.layer.backgroundColor = UIColor.clear.cgColor
}
}
get {
return super.isHighlighted
}
}
open override var isSelected: Bool {
didSet {
self.selectedForegroundView?.layer.backgroundColor = self.isSelected ? self.selectionColor.cgColor : UIColor.clear.cgColor
set {
super.isSelected = newValue
self.selectedForegroundView?.layer.backgroundColor = newValue ? self.selectionColor.cgColor : UIColor.clear.cgColor
}
get {
return super.isSelected
}
}