这是一个高仿 Pinterest app 里面的 Segment 控件, 带有遮罩的动画功能
[
](http://cocoapods.org/?q= PinterestSegment)
[
](http://cocoapods.org/?q= PinterestSegment)
- iOS 8.0+
- Xcode 8.0
- Swift 3.0
You can use CocoaPods to install PinterestSegment
by adding it to your Podfile
:
platform :ios, '8.0'
use_frameworks!
pod 'PinterestSegment'
To get the full benefits import PinterestSegment
wherever you import UIKit
import UIKit
import PinterestSegment
Create a Cartfile
that lists the framework and run carthage update
. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/PinterestSegment.framework
to an iOS project.
github "tbxark/PinterestSegment"
- Download and drop
PinterestSegment.swift
in your project. - Congratulations!
let style = PinterestSegmentStyle()
style.indicatorColor = UIColor(white: 0.95, alpha: 1)
style.titleMargin: CGFloat = 15
style.titlePendingHorizontal: CGFloat = 14
style.titlePendingVertical: CGFloat = 14
style.titleFont = UIFont.boldSystemFont(ofSize: 14)
style.normalTitleColor = UIColor.lightGray
style.selectedTitleColor = UIColor.darkGray
let segment = PinterestSegment(frame: CGRect(x: 20, y: 200, width: w - 40, height: 40), style: style, titles: ["Everything", "Geek", "Humor", "Art", "Food", "Home", "DIY", "Wemoent' Style", "Man's Style", "Beauty", "Travel"])
segment.valueChange = { index in
// Do something here
}
- 1.0.0 first commit
We would love for you to contribute to PinterestSegment, check the LICENSE
file for more info.
TBXark – @vfanx – [email protected]
Distributed under the MIT license. See LICENSE
for more information.