Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @objc private func selection(button: UIButton) {
- nearbyBut.setTitleColor(#colorLiteral(red: 0.5960784314, green: 0.5960784314, blue: 0.5960784314, alpha: 1), for: .normal)
- nearbyBut.imageView?.tintColor = #colorLiteral(red: 0.5960784314, green: 0.5960784314, blue: 0.5960784314, alpha: 1)
- popularBut.setTitleColor(#colorLiteral(red: 0.5960784314, green: 0.5960784314, blue: 0.5960784314, alpha: 1), for: .normal)
- popularBut.imageView?.tintColor = #colorLiteral(red: 0.5960784314, green: 0.5960784314, blue: 0.5960784314, alpha: 1)
- onlineBut.setTitleColor(#colorLiteral(red: 0.5960784314, green: 0.5960784314, blue: 0.5960784314, alpha: 1), for: .normal)
- onlineBut.imageView?.tintColor = #colorLiteral(red: 0.5960784314, green: 0.5960784314, blue: 0.5960784314, alpha: 1)
- tableTitle.fadeTransition(0.5)
- switch button {
- case nearbyBut:
- currentList = .nearby
- nearbyBut.setTitleColor(.blueColor, for: .normal)
- nearbyBut.imageView?.tintColor = .blueColor
- tableTitle.text = "Nearby Tutor"
- case popularBut:
- currentList = .popular
- popularBut.setTitleColor(.blueColor, for: .normal)
- popularBut.imageView?.tintColor = .blueColor
- tableTitle.text = "Pupular Tutor"
- case onlineBut:
- currentList = .all
- onlineBut.setTitleColor(.blueColor, for: .normal)
- onlineBut.imageView?.tintColor = .blueColor
- tableTitle.text = "All Tutor"
- default:
- debugPrint("default!")
- }
- changeSelection(selected: currentList)
- UIView.transition(with: tutorTable, duration: 0.8, options: .transitionCrossDissolve, animations: {self.tutorTable.reloadData()}, completion: nil)
- }
- private func changeSelection(selected: TutorSelection) {
- indicatorCenter.isActive = false
- indicatorTrailing.isActive = false
- indicatorLeading.isActive = false
- switch selected {
- case .all:
- indicatorLeading.isActive = true
- case .nearby:
- indicatorCenter.isActive = true
- case .popular:
- indicatorTrailing.isActive = true
- }
- UIView.animate(withDuration: 0.3, delay: 0.0, options: .curveLinear) {
- self.view.layoutIfNeeded()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement