我有两个独立的分段控件,它们都具有相同的段。如何根据第一个分段控件设置第二个分段控件?
如果在顶部分段控件中选择加仑分段,我希望底部分段控件自动切换到加仑。 Screenshot of the segmented controls
最佳答案
你可以使用类似的东西:
segmentedControl1.addTarget(self, action: #selector(changeAction), forControlEvents: .ValueChanged)
func changeAction() {
segmentedControl2.selectedSegmentIndex = segmentedControl1.selectedSegmentIndex
}
关于swift - 使用一个操作的两个分段控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44524658/