gpt4 book ai didi

swift - 以编程方式选择段索引

转载 作者:行者123 更新时间:2023-11-30 10:47:32 25 4
gpt4 key购买 nike

我有一个名为“segmentSection”的 socket ,但无法设置默认选定的索引值。

我所尝试的应该有效。

@IBOutlet weak var segmentSection: UISegmentedControl!
segmentSection.selectedSegmentIndex = 0

此代码的目标是在上面指示的索引上生成选定状态。

最佳答案

override func viewDidLoad() {
super.viewDidLoad()

segmentSection.selectedSegmentIndex = 0
}

你需要把它放在有用的地方。

关于swift - 以编程方式选择段索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55457346/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com