Swift 自定义 iOS 分段控件 SegmentedControl 。
使用方法:
Create cell:
let cell = SPSegmentedControlCell.init() cell.label.text = "Avenir" cell.imageView.image = UIImage.init(named: "imageName") cell.layout = .textWithImageCreate SegmentedСontrol:
let segmentedСontrol = SPSegmentedControl.init() segmentedСontrol.add(cell: cell)and set frame, add as subview.