Latest 1.2
Homepage https://github.com/fcanas/ios-color-picker
License MIT Copyright (C) 2018 Fabian Canas

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

Platforms ios 9.0, requires ARC
Frameworks QuartzCore, Foundation, UIKit, CoreGraphics
Authors

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

Installation

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.

Screenshots

iPhone

iPhone 5

iPhone 5

iPad

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.

Latest podspec

{
    "name": "iOS-Color-Picker",
    "version": "1.2",
    "summary": "An HSL color-picker for the iPhone.",
    "description": "A reusable, simple color picker for iOS.nn* Works on iPhonen* Works on iPad",
    "homepage": "https://github.com/fcanas/ios-color-picker",
    "license": {
        "type": "MIT",
        "text": "ttCopyright (C) 2018 Fabian CanasnnttPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:nnttThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.nnttTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAREn"
    },
    "authors": {
        "Fabian Canas": "[email protected]"
    },
    "source": {
        "git": "https://github.com/fcanas/ios-color-picker.git",
        "tag": "v1.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "exclude_files": "Example",
    "source_files": "**/*.{h,m}",
    "public_header_files": "FCColorPickerViewController.h",
    "requires_arc": true,
    "resources": [
        "Resources/*.png",
        "FCColorPickerViewController.xib"
    ],
    "frameworks": [
        "QuartzCore",
        "Foundation",
        "UIKit",
        "CoreGraphics"
    ]
}

Pin It on Pinterest

Share This