Code Monkey home page Code Monkey logo

easysegmentedcontrol's Introduction

EasySegmentedControl

Thanks for the author of HMSegmentedControl(oc version).
This is swift version of HMSegmentedControl.
A drop-in replacement for UISegmentedControl mimicking the style of the segmented control used in Google Currents and various other Google products.

Features

  • Supports both text and images
  • Support horizontal scrolling
  • Supports advanced title styling with text attributes for font, color, kerning, shadow, etc.
  • Supports selection indicator both on top and bottom
  • Supports blocks
  • Works with ARC and iOS >= 9

Installation

CocoaPods

The easiest way of installing EasySegmentedControl is via CocoaPods.

pod 'EasySegmentedControl'

Old-fashioned way

  • Add EasySegmentedControl.swift to your project.
  • Add QuartzCore.framework to your linked frameworks.

Usage

The code below will create a segmented control with the default looks:

     	let viewWidth = view.frame.size.width
        let sc = EasySegmentedControl.init(with: ["Trending", "News", "Library"])
        sc.frame = CGRect(x: 0, y: 88, width: viewWidth, height: 40)
        sc.autoresizingMask = [.flexibleRightMargin, .flexibleWidth]
        sc.backgroundsColor = UIColor.clear
        sc.addTarget(self, action: #selector(segmentedControlChangedValue(segmentedControl:)), for: .valueChanged)
        view.addSubview(sc)

Included is a demo project showing how to fully customise the control.

EasySegmentedControl

Apps using EasySegmentedControl

If you are using EasySegmentedControl in your app or know of an app that uses it, please add it to this list.

License

EasySegmentedControl is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

If this code was helpful, I would love to hear from you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.