在 UISegmented 控件中禁用段
Disable Segments in a UISegmented Control
我有 9 个分段控件,每个控件有 3 个分段。
我在所有这些上都选择了第 3 段,现在想禁用每个上的前 2 个段。
到目前为止的代码如下,我需要做哪些更改?
[q2SegControl, q3SegControl, q4SegControl, q5SegControl, q6SegControl, q7SegControl, q8SegControl, q9SegControl, q10SegControl].forEach {
segmentedControl.setEnabled=false,forSegmentAt:0,1}
我相信你必须这样使用它:
[q2SegControl, q3SegControl, q4SegControl, q5SegControl, q6SegControl, q7SegControl, q8SegControl, q9SegControl, q10SegControl].forEach { segmentedControl in
segmentedControl.setEnabled(false, forSegmentAt: 0)
segmentedControl.setEnabled(false, forSegmentAt: 1)
}
我有 9 个分段控件,每个控件有 3 个分段。 我在所有这些上都选择了第 3 段,现在想禁用每个上的前 2 个段。 到目前为止的代码如下,我需要做哪些更改?
[q2SegControl, q3SegControl, q4SegControl, q5SegControl, q6SegControl, q7SegControl, q8SegControl, q9SegControl, q10SegControl].forEach {
segmentedControl.setEnabled=false,forSegmentAt:0,1}
我相信你必须这样使用它:
[q2SegControl, q3SegControl, q4SegControl, q5SegControl, q6SegControl, q7SegControl, q8SegControl, q9SegControl, q10SegControl].forEach { segmentedControl in
segmentedControl.setEnabled(false, forSegmentAt: 0)
segmentedControl.setEnabled(false, forSegmentAt: 1)
}