VGSegment
带有线条动画的分割菜单
需求
- Swift 3
- iOS 8.0+
- XCode 8
使用方式
class ViewController: UIViewController, VGSegmentDelegate{
override func viewDidLoad() {
super.viewDidLoad()
let rect = CGRect(x: 0, y: 250, width: view.frame.width, height: 45)
let titles = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"]
let segment = VGSegment(frame: rect, titles: titles)
segment.delegate = self
view.addSubview(segment)
var configuration: VGSegmentConfiguration {
let configura = VGSegmentConfiguration()
// TODO: configuration segment
return configura
}
segment.configuration = configuration
}
func didSelectAtIndex(_ index: Int) {
print("selectIndex:", index)
}
}
安装
-
下载 VGSegment. 将其移动到您的项目中。
-
Cocoapods
platform :ios, ‘8.0’
use_frameworks!
pod "VGSegment"
- Carthage
github "VeinGuo/VGSegment" ~> 1.0.1
版本
- 1.0 发布版 (05/28/2017)
- 1.0.1 发布版 (05/31/2017)
- 1.0.2 修复水平和垂直自动布局