我正在尝试使用(isHidden)UISegmented Control处理UIViews隐藏/显示,这是我如何处理这一问题的专业方法。
{{1}}
答案 0 :(得分:0)
您可以这样做:
@IBOutlet weak var flightTypeSegCont: UISegmentedControl!
@IBAction func flightType(_ sender: UISegmentedControl) {
let shouldHide = flightTypeSegCont.selectedSegmentIndex == 0
self.direcrCard.isHidden = !shouldHide
self.ViaCardView.isHidden = shouldHide
}