Define click event for UISegmentedControl

前端 未结 8 2420
无人及你
无人及你 2020-12-13 11:53

I have added a UISegmentedControl in my application. None of the buttons are selected in normal state. I want to implement a button click event when the first

8条回答
  •  自闭症患者
    2020-12-13 12:28

    try this:

    - (IBAction)segmentSwitch:(UISegmentedControl *)sender {
          NSInteger selectedSegment = sender.selectedSegmentIndex;
    
          if (selectedSegment == 0) {
    
          }
          else{
    
          }
        }
    

提交回复
热议问题