一个由多个标签组成的水平控件TabLayoutView
,每个标签都作为独立的按钮。
要运行示例项目,请克隆代码库,然后首先从Example目录运行pod install
。
TabLayoutView
// Initialize the tab layout view
let origin = CGPoint(x: 0, y: 0)
let size = CGSize(width: 280, height: 44)
let frame = CGRect(origin:origin, size:size)
let tabLayoutView = TabLayoutView(frame: frame)
tabLayoutView.center = self.view.center
// Set the type
tabLayoutView.type = .normal
// Set the indicator position
tabLayoutView.indicatorPosition = .bottom
// Set the indicator color
tabLayoutView.indicatorColor = .red
// Set the font color
tabLayoutView.fontColor = .red
// Set the font selected color
tabLayoutView.fontSelectedColor = .black
// Set the items
tabLayoutView.items = ["Test A", "Test B", "Test C", "Test D", "Test E", "Test F", "Test G", "Test H", "Test I", "Test L"]
// Set the delegate
tabLayoutView.delegate = self
// Add it as a subview
self.view.addSubview(tabLayoutView)
也支持Xib和Storyboard
CocoaPods
Dario Trisciuoglio
TabLayoutView遵循MIT许可证。有关更多信息,请参阅LICENSE文件。