欢迎光临
我们一直在努力

WBSegmentControl 可仿-微博头条

建站超值云服务器,限时71元/月

WBSegmentControl 可仿-微博头条

项目介绍:

WBSegmentControl  托管地址
Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

WBSegmentControl is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "WBSegmentControl"

Usage
WBSegmentControlDelegate
[Objective-C] 查看源文件 复制代码

public protocol WBSegmentControlDelegate {
    func segmentControl(segmentControl: WBSegmentControl, selectIndex newIndex: Int, oldIndex: Int)
}

How to use
[Objective-C] 查看源文件 复制代码

let segmentControl = WBSegmentControl() // initialize
segmentControl.segments = [
    WBSegmentControl.Segment(type: .Text("A")),
    WBSegmentControl.Segment(type: .Text("B")),
] // set segments
segmentControl.style = .Rainbow // set style
segmentControl.selectedIndex = 0 // set selected index, but does not trigger the delegate method
segmentControl.initialize(atIndex: 0) // set selected index, and trigger the delegate method, useful for setting the initial state

CustomizeSettings –
Common
[Objective-C] 查看源文件 复制代码

public var indicatorStyle: IndicatorStyle = .Rainbow
public var nonScrollDistributionStyle: NonScrollDistributionStyle = .Average
public var enableSeparator: Bool = false
public var separatorColor: UIColor = UIColor.blackColor()
public var separatorWidth: CGFloat = 9
public var separatorEdgeInsets: UIEdgeInsets = UIEdgeInsets(top: 8, left: 4, bottom: 8, right: 4)
public var enableSlideway: Bool = false
public var slidewayHeight: CGFloat = 1
public var slidewayColor: UIColor = UIColor.lightGrayColor()
public var enableAnimation: Bool = true
public var animationDuration: NSTimeInterval = 0.15
public var contentBackgroundColor: UIColor = UIColor.whiteColor()
public var segmentMinWidth: CGFloat = 50
public var segmentEdgeInsets: UIEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
public var segmentTextBold: Bool = true
public var segmentTextFontSize: CGFloat = 12
public var segmentTextForegroundColor: UIColor = UIColor.grayColor()
public var segmentTextForegroundColorSelected: UIColor = UIColor.blackColor()

Settings – indicatorStyle == .Cover
[Objective-C] 查看源文件 复制代码

public var cover_range: CoverRange = .Segment
public var cover_opacity: Float = 0.2
public var cover_color: UIColor = UIColor.blackColor()

Settings – indicatorStyle == .Strip
[Objective-C] 查看源文件 复制代码

public var strip_range: StripRange = .Content
public var strip_location: StripLocation = .Down
public var strip_color: UIColor = UIColor.orangeColor()
public var strip_height: CGFloat = 3

Settings – indicatorStyle == .Rainbow
[Objective-C] 查看源文件 复制代码

public var rainbow_colors: [UIColor] = []
public var rainbow_height: CGFloat = 3
public var rainbow_roundCornerRadius: CGFloat = 4
public var rainbow_location: RainbowLocation = .Down
public var rainbow_outsideColor: UIColor = UIColor.grayColor()

Settings – indicatorStyle == .Arrow
[Objective-C] 查看源文件 复制代码

public var arrow_size: CGSize = CGSizeMake(6, 6)
public var arrow_location: ArrowLocation = .Down
public var arrow_color: UIColor = UIColor.orangeColor()

Settings – indicatorStyle == .ArrowStrip
[Objective-C] 查看源文件 复制代码

public var arrowStrip_location: ArrowStripLocation = .Up
public var arrowStrip_color: UIColor = UIColor.orangeColor()
public var arrowStrip_arrowSize: CGSize = CGSizeMake(6, 6)
public var arrowStrip_stripHeight: CGFloat = 2
public var arrowStrip_stripRange: ArrowStripRange = .Content

Author

xiongxiong, ximengwuheng@163.com

DEMO 直接下载:

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » WBSegmentControl 可仿-微博头条
分享到: 更多 (0)