【问题标题】:Make certain UIButtons disappear using UISegmentedControl使用 UISegmentedControl 使某些 UIButtons 消失
【发布时间】:2012-09-11 02:52:31
【问题描述】:

我的情节提要中有一组 UIButtons 和一个 UISegmentedControl,其中包含 3 个片段。
UISegmentedControl 的段应该如下工作;
选择第一个时,显示所有按钮,
选择第二个时,隐藏 Button - Button1Button - Button2
(选择第三个时,隐藏 Button - Button1Button - Button2Button - Button3)。

我应该怎么做才能做到这一点?

【问题讨论】:

    标签: objective-c ios xcode uibutton uisegmentedcontrol


    【解决方案1】:
    1. 将视图控制器指定为分段控件的目标并实现操作消息。您可以在 IB 中执行此操作,也可以使用 addTarget:action:forControlEvents: 并将事件类型设置为 UIControlEventValueChanged
    2. 在值更改操作方法中,使用其hidden 属性隐藏或显示您想要的按钮。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-13
      • 2015-12-31
      • 2022-07-23
      • 1970-01-01
      • 2014-09-02
      相关资源
      最近更新 更多