How do I switch UIsegmentedControl programmatically?

后端 未结 6 1507
孤独总比滥情好
孤独总比滥情好 2021-02-01 11:47

How do I switch UISegmentedControl programmatically ?

6条回答
  •  终归单人心
    2021-02-01 12:24

    @jmstone response, true, this action will not invoke the valueChanged event for this control.

    One way to overcome this is to just call the function yourself:

    segmentedControl.selectedSegmentIndex = 3;
    [self valueChangedMethod:segmentedControl];
    

    This will call:

    - (void)valueChangedMethod:(UISegmentedControl *)segmentedControl
    {
        //continue your code here...
    }
    

提交回复
热议问题