Skip to content

Instantly share code, notes, and snippets.

@HassanElDesouky
Created August 28, 2019 07:55
Show Gist options
  • Save HassanElDesouky/aa258f4a48cb6666e9368df3a0bf8a14 to your computer and use it in GitHub Desktop.
Save HassanElDesouky/aa258f4a48cb6666e9368df3a0bf8a14 to your computer and use it in GitHub Desktop.
class ListIconController: UIViewController {
@IBOutlet weak var chooseColorView: UIView!
@IBOutlet weak var chooseOtherView: UIView!
@IBOutlet weak var chooseGlyphView: UIView!
fileprivate func setupViews() {
switchViews(firstView: 1.0, secondView: 0.0, thirdView: 0.0)
}
private func switchViews(firstView: CGFloat, secondView: CGFloat, thirdView: CGFloat) {
chooseColorView.alpha = firstView
chooseOtherView.alpha = thirdView
chooseGlyphView.alpha = secondView
}
@IBAction func handleSelectView(_ sender: UISegmentedControl) {
switch sender.selectedSegmentIndex {
case 0:
switchViews(firstView: 1.0, secondView: 0.0, thirdView: 0.0)
break
case 1:
switchViews(firstView: 0.0, secondView: 1.0, thirdView: 0.0)
break
case 2:
switchViews(firstView: 0.0, secondView: 0.0, thirdView: 1.0)
break
default:
break
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment