Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

VeinGuo/VGSegment

Repository files navigation

VGSegment

A segment menu with line animation

Swift build License MIT Platform pod

demo1

demo2

Requirements

  • Swift 5
  • iOS 8.0+
  • XCode 10.2

Usage

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)
    }

}

Installation

  • Download VGSegment. Move to your project.

  • Cocoapods

platform :ios, ‘8.0’
use_frameworks!
pod "VGSegment"
  • Carthage
github "VeinGuo/VGSegment" ~> 1.0.1

Version

  • 1.0 Release (05/28/2017)
  • 1.0.1 Release (05/31/2017)
  • 1.0.2 fix horizontal and vertical autolayout