У меня есть сегментированный элемент управления, который имеет 4 сегмента, как на картинке.Как создать и выделить красную линию волос (вниз), когда какой-либо сегментированный выбран в сегментированном управлении в Swift
Foe например: Проводная, Managed Mobility
Я хотел бы получить красный цвет в нижней части (волосяной покров), когда выбран какой-либо сегмент; в основном он должен показать красную линию в выбранном сегменте
мой текущий код выглядит следующим образом
func changeColor(sender: UISegmentedControl){
if sender.selectedSegmentIndex == 0 {
UIView.animateWithDuration(0.5, animations: {
self.containerAccountSummary.alpha = 1
self.containerLocationTracker.alpha = 0
self.containerWireline.alpha = 0
self.containerManagedMobility.alpha = 0
self.containerMobileVoiceAndData.alpha = 0
})
} else if sender.selectedSegmentIndex == 1{
UIView.animateWithDuration(0.5, animations: {
self.containerAccountSummary.alpha = 0
self.containerLocationTracker.alpha = 1
self.containerWireline.alpha = 0
self.containerManagedMobility.alpha = 0
self.containerMobileVoiceAndData.alpha = 0
})
}else if sender.selectedSegmentIndex == 2{
UIView.animateWithDuration(0.5, animations: {
self.containerAccountSummary.alpha = 0
self.containerLocationTracker.alpha = 0
self.containerWireline.alpha = 1
self.containerManagedMobility.alpha = 0
self.containerMobileVoiceAndData.alpha = 0
})
}else if sender.selectedSegmentIndex == 3{
UIView.animateWithDuration(0.5, animations: {
self.containerAccountSummary.alpha = 0
self.containerLocationTracker.alpha = 0
self.containerWireline.alpha = 0
self.containerManagedMobility.alpha = 1
self.containerMobileVoiceAndData.alpha = 0
})
}else {
UIView.animateWithDuration(0.5, animations: {
self.containerAccountSummary.alpha = 0
self.containerLocationTracker.alpha = 0
self.containerWireline.alpha = 0
self.containerManagedMobility.alpha = 0
self.containerMobileVoiceAndData.alpha = 1
})
}
}
любые советы?