Giter Site home page Giter Site logo

fiam / hmsegmentedcontrol Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heshammegid/hmsegmentedcontrol

0.0 3.0 0.0 889 KB

A drop-in replacement for UISegmentedControl mimicking the style of the segmented control used in Google Currents and various other Google products.

License: Other

Ruby 1.37% Objective-C 98.63%

hmsegmentedcontrol's Introduction

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
  • Font and all colors are customizable
  • Supports selection indicator both on top and bottom
  • Supports blocks
  • Works with ARC and iOS >= 5

Installation

CocoaPods

The easiest way of installing HMSegmentedControl is via CocoaPods.

pod 'HMSegmentedControl', '~> 1.4.0'

Old-fashioned way

  • Add HMSegmentedControl.h and HMSegmentedControl.m to your project.
  • Add QuartzCore.framework to your linked frameworks.
  • #import "HMSegmentedControl.h" where you want to add the control.

Usage

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

HMSegmentedControl *segmentedControl = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"One", @"Two", @"Three"]];
segmentedControl.frame = CGRectMake(10, 10, 300, 60);
[segmentedControl addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:segmentedControl];

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

HMSegmentedControl

Change log

  • v1.4
    • Lots of bug fixes
    • Add AutoLayout support
    • Adds HMSegmentedControlSelectionStyleArrow
    • Adds support for non-animated selections.
    • Adds support for custom box layer opacity.
    • Add support for multi-line labels on iOS 7+
    • Updated documentation in header file
  • v1.3.0
    • Introducing horizontal scrolling via scrollEnabled property. Check example project
    • Adds XIB/Storyboard support
    • Fixes deprecations when building with iOS 7 SDK
    • Updates example project to support iOS 7
    • Code refactoring and cleanup
  • v1.2.0
    • Added new selection indicator style: HMSelectionIndicatorBox
    • Added ability to set text colour for selected segment (thanks to @jmkr)
    • Segment titles are now added in a separate CATextLayer, and images are drawn in a separate CALayer
    • Calls to index change block/selector now happen before the animation starts
    • Lots of code refactoring and clean up
  • v1.1.0 (merged pull request from @jacksonpan)
    • Added image support
    • Support for changing selection indicator position
  • v1.0.0
    • Initial release

Apps using HMSegmentedControl

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

License

HMSegmentedControl 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.

@HeshamMegid
http://hesh.am

hmsegmentedcontrol's People

Contributors

alexandreos avatar dmitric avatar fiam avatar gaijin03 avatar goncharik avatar hanishabsigh avatar heshammegid avatar jacksonpan avatar jmkr avatar mrtristan avatar sergey-sportsetter avatar shjborage avatar

Watchers

 avatar  avatar  avatar

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.