am using Xcode 8.1 , swift 3.0
i have code Segmented its work with 2 control
when i try add 3 its not working any idea what is wrong with my code
this one work with 2 Segmented
@IBAction func showComponent(_ sender: UISegmentedControl) {
if sender.selectedSegmentIndex == 0 {
UIView.animate(withDuration: 0.0, animations: {
self.containerViewA.alpha = 1
self.containerViewB.alpha = 0
})
} else {
UIView.animate(withDuration: 0.0, animations: {
self.containerViewA.alpha = 0
self.containerViewB.alpha = 1
})
}
}
this one not working with 3 Segmented
here am trying new code with 3x Segmented control;
@IBAction func showComponent(_ sender: UISegmentedControl) {
if sender.selectedSegmentIndex == 0 {
UIView.animate(withDuration: 0.5, animations: {
self.containerViewA.alpha = 1
self.containerViewB.alpha = 0
self.containerViewC.alpha = 0
})
UIView.animate(withDuration: 0.5, animations: {
self.containerViewA.alpha = 0
self.containerViewB.alpha = 1
self.containerViewC.alpha = 0
} else {
UIView.animate(withDuration: 0.5, animations: {
self.containerViewA.alpha = 0
self.containerViewB.alpha = 0
self.containerViewC.alpha = 1
})
}
}