ios - 如何用 THSegmentedControl 替换 UISegmentedControl

标签 ios objective-c

我一直在使用UISegmentControl Storyboard 上的对象,但它只支持选择单个片段,

enter image description here

所以我找到了一个替代方案 THSegmentedControl .现在的问题是我无法在 Identity Inspector 中替换 UISegmentControl 类,它只显示 UISegmentedControl:

enter image description here

项目导航 View :

enter image description here

那么我该如何使用 THSegmentedControl 呢?

我刚刚复制了两个文件 THSegmentedControl.h/m 还有其他需要的设置吗?

最佳答案

THSegmentedControl 不是 UISegmentedControl 的子类,而是 UIControl 的子类:

@interface THSegmentedControl : UIControl

您将无法使用此控件设置 UISegmentedControl IB 对象。相反,将 IB 对象替换为 UIView 对象,然后将其类设置为 THSegmentedControl

关于ios - 如何用 THSegmentedControl 替换 UISegmentedControl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30149231/

相关文章:

iphone - AVAudioPlayer 不会在 15 次中播放一次音频

ios - 从 iOS 应用程序启动 watchOS2 应用程序

ios - UIView 拆分过渡

objective-c - 使用 XCode4 中的文件夹引用自动包含/编译源代码

ios - UITextField 导致应用程序在 iOS 8 上卡住

ios - 检测 NSMutable 数组中包含的重复自定义对象

ios - 适用于 iOS 的 Google 身份验证器丢失文件

ios - swift 4,核心数据: error: Failed to load model named textTabelView

ios - removefromsuperview 是否删除 subview ?

objective-c - 创建数据库文件(如果不存在)