ios - 使用多个分段控件管理 UITableView

标签 ios xcode uitableview swift uisegmentedcontrol

我试图做到这一点,如果任何分段控件发生变化,顶部的应用按钮就会启用。我还需要能够访问每个人的值(value)。我正在使用 swift 。这是它的样子:

iOS Simulator Screenshot

感谢您的帮助。

最佳答案

I assume you must have subclass of your UITableViewCell. If you don't have make subclass of UITableViewCell

In subclass
1. Create as weak property of UISegementControl
2. Create protocol
protocol TableViewCellDelegate
{
 func segmentSelected(sender:UISegmentControl)
}
3. create delegate as weak refrence for protocol

In Interface Builder
1. link your UISegementControl to your UITableViewController
2. link your delegate to your UITableViewController

In UITableViewController

func segmentSelected(sender:UISegmentControl)
{
  // here you get value changed segment
}

关于ios - 使用多个分段控件管理 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28610277/

相关文章:

ios - 如何更改 "share your information"中的公司名称以在 iTunes 中自动续订?

ios - 径向 CAGradientLayer 在运行时无法正确渲染

ios - SceneKit 与 Vuforia AR 库自定义模型

ios - 如何更改在 Xcode UI 测试 (XCUITest) 中获取快照所需的时间?

ios - UITableView 删除行减少表格行高

ios - TabBarController 内的 UIWebView 导致内容位于选项卡栏后面

objective-c - OSX cocoa 应用程序 : Which method for rescaling an image is best with respect to image quality?

ios - 如何将视频添加到 Storyboard页面 (Xcode 6)

ios - 如何在动画中更改 UITableView 标签 textColor 两次?

ios - 实时更新自定义表格部分标题 View 内容