From 8c649841eeebcb0ec300577b60d4dde600f9a678 Mon Sep 17 00:00:00 2001 From: WenchaoD Date: Thu, 9 Mar 2017 14:29:19 +0800 Subject: [PATCH] Avoid some non-objc features. --- Sources/FSPagerViewCell.swift | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Sources/FSPagerViewCell.swift b/Sources/FSPagerViewCell.swift index 946eee2..11b2bd7 100644 --- a/Sources/FSPagerViewCell.swift +++ b/Sources/FSPagerViewCell.swift @@ -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 } }