测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可证 | MIT |
发布最后发布 | 2017年6月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Bruno Miguens 维护。
这是一个具有每个段图标和文本的自定义 Segmented Control。
let segmentedControl = BMSegmentedControl(withIcon: view.bounds,
items: ["Happy", "Normal", "Sad"],
icons: [UIImage(named: "happy_gray")!, UIImage(named: "flat_gray")!, UIImage(named: "sad_gray")!],
selectedIcons: [UIImage(named: "happy_white")!, UIImage(named: "flat_white")!, UIImage(named: "sad_white")!],
backgroundColor: .white,
thumbColor: .lightGray,
textColor: .black,
selectedTextColor: .cyan,
orientation: .leftRight
)
let segmentedControl = BMSegmentedControl(withoutIcon: view.bounds,
items: titles,
backgroundColor: .white,
thumbColor: .lightGray,
textColor: .black,
selectedTextColor: .cyan
)
// To get the changed value event, set it manually on your view controller
segmentedControl.addTarget(self, action: #selector(segmentedHasChanged), for: .valueChanged)
// You need to add BMSegmnetedControl to container
view.addSubview(segmentedControl)
// You could set the selected index. Default is 0
segmentedControl.selectedIndex = 1
BMSegmentedControl 采用 MIT 许可证发布。有关详细信息,请参阅 LICENSE。