Skip to content

NoahFetz/PinterestSegment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PinterestSegment

这是一个高仿 Pinterest app 里面的 Segment 控件, 带有遮罩的动画功能

Swift Version License MIT [CocoaPods](http://cocoapods.org/?q= PinterestSegment) [CocoaPods](http://cocoapods.org/?q= PinterestSegment) Carthage compatible Support

Requirements

  • iOS 8.0+
  • Xcode 8.0
  • Swift 3.0

Installation

CocoaPods

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

Carthage

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"

Manually

  1. Download and drop PinterestSegment.swift in your project.
  2. Congratulations!

Usage example


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
}

Release History

  • 1.0.0 first commit

Contribute

We would love for you to contribute to PinterestSegment, check the LICENSE file for more info.

Meta

TBXark – @vfanx[email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/TBXark

About

A Pinterest-like segment control with masking animation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 96.3%
  • Ruby 3.7%