简体   繁体   English

在 UISegmented 控件中禁用段

[英]Disable Segments in a UISegmented Control

I have 9 Segmented Controls, each with 3 Segments.我有 9 个分段控件,每个控件有 3 个分段。 I have selected Segment 3 on all of them, and now want to disable the first 2 segments on each of them.我在所有这些上都选择了第 3 段,现在想要禁用每个上的前 2 段。 Code so far is as below, what changes do I need to make?到目前为止的代码如下,我需要进行哪些更改?

    [q2SegControl, q3SegControl, q4SegControl, q5SegControl, q6SegControl, q7SegControl, q8SegControl, q9SegControl, q10SegControl].forEach {
            segmentedControl.setEnabled=false,forSegmentAt:0,1}

I believe you have to use it like this:我相信你必须像这样使用它:

[q2SegControl, q3SegControl, q4SegControl, q5SegControl, q6SegControl, q7SegControl, q8SegControl, q9SegControl, q10SegControl].forEach { segmentedControl in
    segmentedControl.setEnabled(false, forSegmentAt: 0)
    segmentedControl.setEnabled(false, forSegmentAt: 1)
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM