【问题标题】:How to change the segmented control actions when click on button?单击按钮时如何更改分段控制动作?
【发布时间】:2016-05-28 19:00:55
【问题描述】:

嗨,在我的应用程序中,我想在单击按钮时更改分段控制操作。这里我附上我的图像。

在上图中,默认分段控件为 =0,当我单击 + 按钮时,分段控件更改为 1。

【问题讨论】:

  • u绑定分段控制的动作方法?

标签: objective-c uibutton uisegmentedcontrol


【解决方案1】:

在按钮上单击更改分段控件-> selectedSegmentIndex

Tempsegment.selectedSegmentIndex = 1;

并调用绑定值更改的操作

- (IBAction)TempsegmentAction:(id)sender 
{
    if (Tempsegment.selectedSegmentIndex==0) 
    {
       // for segment index 0
    }
    else
    {
      // for segment index 1
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-30
    • 1970-01-01
    • 2022-01-15
    • 1970-01-01
    • 2014-11-04
    • 2018-02-18
    • 2021-03-19
    相关资源
    最近更新 更多