Fetching contributors…
Cannot retrieve contributors at this time
75 lines (50 sloc) 3.02 KB

iOS Color Picker

Version License Platform

A reusable color picker component for iOS. Works for iPhone, iPad, in modal sheets, popovers... just about anywhere.

Using iOS-Color-Picker


The easiest way to use iOS-Color-Picker is with CocoaPods. Add the following line to your Podfile.

pod 'iOS-Color-Picker'

Otherwise, you need to include the following files in your project:

  • FCColorPickerViewController.h
  • FCColorPickerViewController.m
  • FCColorPickerViewController.xib
  • Resources/colormap.png

Using a Color Picker from a View Controller

Suppose you have a view controller with a color property you'd like to let the user pick. Make your view controller implement the FCColorPickerViewControllerDelegate protocol. Handle the color picked and the cancelled methods, and make a method that triggers showing the view controller.

-(IBAction)chooseColor:(id)sender {
    FCColorPickerViewController *colorPicker = [FCColorPickerViewController colorPicker];
    colorPicker.color = self.color;
    colorPicker.delegate = self;
    [colorPicker setModalPresentationStyle:UIModalPresentationFormSheet];
    [self presentViewController:colorPicker animated:YES completion:nil];

#pragma mark - FCColorPickerViewControllerDelegate Methods

-(void)colorPickerViewController:(FCColorPickerViewController *)colorPicker didSelectColor:(UIColor *)color {
    self.color = color;
    [self dismissViewControllerAnimated:YES completion:nil];

-(void)colorPickerViewControllerDidCancel:(FCColorPickerViewController *)colorPicker {
    [self dismissViewControllerAnimated:YES completion:nil];

The color picker has tintColor and backgroundColor properties for configuring its appearance.



iPhone 5

iPhone 5


iPhone 5

iPhone 5

Example Project

An example project is included in /Example. Run pod install in the example directory to configure the project, then open the Xcode workspace.