Skip to content

Commit

Permalink
Avoid some non-objc features.
Browse files Browse the repository at this point in the history
  • Loading branch information
WenchaoD committed Mar 9, 2017
1 parent 27cc008 commit 8c64984
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Sources/FSPagerViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 8c64984

Please sign in to comment.