GithubHelp home page GithubHelp logo

sg7 / ios-filter-control Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shadyelyaski/ios-filter-control

1.0 2.0 0.0 255 KB

An iOS Filter UIControl Subclass. Zero Graphics. Highly Customizable.

License: MIT License

ios-filter-control's Introduction

iOS Filter Control

An iOS Filter UIControl Subclass. Zero Graphics. Highly Customizable.

Inspired by National Geographics: Park Guides.

Installation

  1. In your XCode Project, take the SEFilterControl.h and .m & SEFilterKnob.h and .m from ios-filter-control folder and drag them into your project.
  2. Start using this new UIControl Subclass!

SDK Support

It supports iOS 4 to iOS 6

Screenshot

Here's a screenshot for different variations

My image

You may watch a demo video on Youtube

Documentation

The class is not very well documented. I tried documenting drawing code as much as I could.

There are sample codes that illustrate various parameters.

Usage

Creating your filter

Somewhere, for example in your viewDidLoad, alloc and init the filter UIControl:

SEFilterControl *filter = [[SEFilterControl alloc]initWithFrame:CGRectMake(10, 20, 300, 70) Titles:[NSArray arrayWithObjects:@"Articles", @"News", @"Updates", @"Featured", @"Newest", @"Oldest", nil]];

This initializes our Filter Control using CGRect and Titles Array of NSStrings.

Note That height of the control is predifined as 70 and can't be changed

Then, add target for Value Change Event handling:

[filter addTarget:self action:@selector(filterValueChanged:) forControlEvents:UIControlEventValueChanged];

Don't forget to impelment the handler we specified later:

-(void)filterValueChanged:(SEFilterControl *) sender{
	NSLog(@"%@", [NSString stringWithFormat:@"%d", sender.SelectedIndex]);
}

Adding to your UIView & releasing the object:

[self.view addSubview:filter];
[filter release];

Customizing your filter

To change the track color:

[filter setProgressColor:[UIColor lightGrayColor]];

To change the handler color:

[filter setHandlerColor:[UIColor darkGrayColor]];

To change the Titles text color:

[filter setTitlesColor:[UIColor blackColor]];

To change the Titles text font:

[filter setTitlesFont:[UIFont fontWithName:@"Didot" size:14]];

Acknowledgment

Special thanks to mash, Ltd. team for their support.

License

This Code is released under the MIT License by Shady Elyaski

Would love to hear from you when you use this custom UIControl in your project!

Cheers,

Shady A. Elyaski

http://www.elyaski.com

ios-filter-control's People

Contributors

shadyelyaski avatar

Stargazers

 avatar

Watchers

 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.