Giter VIP home page Giter VIP logo

ios-filter-control's Introduction

iOS Filter Control

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

Inspired by National Geographics: Park Guides.

Screenshot

Here's a screenshot for different variations

ScreenShot

My image

You may watch a demo video on Youtube

Installation

Cocoapods: pod 'SEFilterControl'

Manual:

  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 5 to iOS 8 Live rendering in Interface builder will require Xcode 6.x

Usage

Creating your filter

By Code

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 predefined as 70 and can't be changed Use SEFilterControl_HEIGHT const for reference.

Then, add target for Value Change Event handling:

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

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

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

Adding to your UIView:

	[self.view addSubview:filter];

Via Interface builder

Add a new UIView to your xib, and update its class to SEFilterControl. Bind a UIAction to the valueChanged event of your control. Enjoy ;)

Configuration

Filter

| Property | Effect | Default value | |:-------------:|-------------|-----|-----| | progressColor | Progress track color | SEFilterControl_DEFAULT_PROGRESS_COLOR | | titlesFont | Configure all titles font | SEFilterControl_DEFAULT_TITLE_FONT | | titlesColor | Configure all titles color | SEFilterControl_DEFAULT_TITLE_COLOR | | titlesShadowColor | Configure all titles shadow color | SEFilterControl_DEFAULT_TITLE_SHADOW_COLOR |

Knob

| Property | Effect | Default value | |:-------------:|-------------| -----|---| | handlerColor | Configure knob color | SEFilterKnob_DEFAULT_HANDLER_COLOR | | shadowColor | Configure knob shadow color | SEFilterKnob_DEFAULT_SHADOW_COLOR | | shadow | Enable / sisable shadow | SEFilterKnob_DEFAULT_SHADOW |

Continuous mode

If continuous is set to YES, filter will generate valueChanged events will user is dragging the knb. If NO, an event will be sent once knob released.

UIAppearance

SEFilterControl and SEFilterKnob declare UIAppearance methods, allowing you to style all instances at a time.

Acknowledgment

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

Thanks to Nicolas Goutaland for the updated version.

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

jaroslavas avatar jghazarian avatar nicolasgoutaland avatar paulpilone avatar shadyelyaski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-filter-control's Issues

How to use with UiPageControl

Hi,

I need to add the filters with the UIpageviewController, Tap is working fine but when i am trying to swipe to change the filter pageviewController scrolling.

Any suggestion to fix this ?

Different max and min track colours

Hi,
Nice work :).
I would like to have different colors for maximum and minimum track colours.
Any suggestions on how can I implement this?

Change Request

Hi @ShadyElyaski,

I was trying to rotate your control by 90 degree but its not working. I have tried using
filter.layer.transform = CATransform3DRotate( CATransform3DIdentity,-1.57079633,0,0,1);
and
filter.transform = CGAffineTransformMakeRotation(M_PI/2);.

I have a wide length of text to display, which is not accommodating on this control so i thought of rotating it.
It would be great to see this change. Let me know your thoughts on this.

Thanks :]

Feature Request: Range selector

So be able to select two values on the filter control allowing a range to be selected

Ex: say the numbers are 1 -9. You could put the first on number 3 and the second on number 8 giving you the range 3-8

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.