Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 107 lines (78 sloc) 3.95 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
//
// ColorPickerViewController.h
// ColorPicker
//
// Created by Fabián Cañas
// Based on work by Gilly Dekel on 23/3/09
// Copyright 2010-2014. All rights reserved.
//

#import <UIKit/UIKit.h>

/**
`FCColorPickerViewController` is a view controller that displays a color picker to the user.
To use it, instantiate a `FCColorPickerViewController` with one of the class constructors, set a delegate that
implements the `FCColorPickerViewControllerDelegate` protocol, and present the color picker however you wish,
*e.g.* modally full screen, modally in a form, in a popover, etc. You are responsible for dismissing the color
picker when the user finishes picking a color. The delegate methods in the `FCColorPickerViewControllerDelegate`
protocol and the `color` property of the color picker provide a reference to the color the user picked.
*/
@class FCColorPickerViewController, FCBrightDarkGradView, FCColorSwatchView;

/**
The delegate of an `FCColorPickerViewController` must adopt the `FCColorPickerViewControllerDelegate` protocol.
The primary responsibility of the delegate is hiding or dismissing the picker controller when the picker has finished.
The delegate is the object that is told which color the picker picked.
*/
@protocol FCColorPickerViewControllerDelegate <NSObject>

/**
Called on the delegate of `colorPicker` when the user has finished selecting a color.
@param colorPicker The `FCColorPickerViewController` that has finished picking a color.
@param color The color that was picked by the user.
*/
- (void)colorPickerViewController:(FCColorPickerViewController *)colorPicker didSelectColor:(UIColor *)color;

/**
Called on the delegate of `colorPicker` when the user has canceled selecting a color.
@param colorPicker The `FCColorPickerViewController` that has canceled picking a color.
*/
- (void)colorPickerViewControllerDidCancel:(FCColorPickerViewController *)colorPicker;

@end

@interface FCColorPickerViewController : UIViewController

/// @name Initializing a Color Picker object

/**
Creates and returns a color picker.
*/
+ (instancetype)colorPicker;

/**
Creates and returns a color picker initialized with the provided color and delegate.
@paran color The initial value for the color picker's `color` property. The color picker will represent this color when presented.
@param delegate An object implementing the `FCColorPickerViewControllerDelegate` protocol to act as the picker's delegate
@see -color,
@see -delegate
*/
+ (instancetype)colorPickerWithColor:(UIColor *)color delegate:(id<FCColorPickerViewControllerDelegate>) delegate;

/// @name The Color

/**
The color that the picker is representing.
Its value changes as the user interacts with the picker, and changing the property will update the UI accordingly.
*/
@property (readwrite, nonatomic, copy) UIColor *color;

/// @name Managing the Delegate

/**
The object that acts as the delegate of the receiving color picker.
The delegate must adopt the `FCColorPickerViewControllerDelegate` protocol. The delegate is not retained.
@see FCColorPickerViewControllerDelegate protocol
*/
@property (nonatomic, weak) id<FCColorPickerViewControllerDelegate> delegate;

/// @name Controlling the Color Picker's Appearance

/**
The view controller's background color.
The default value is nil, which results in a dark gray color on iPhones, and a clear color on iPads.
@see -tintColor
*/
@property (nonatomic, copy) UIColor *backgroundColor;

/**
The view controller's tint color.
Updates to the `tintColor` property are forwarded to the color picker's view. The tint color affects the coloring of the "Choose" and "Cancel" buttons in iOS 7. Below iOS 7, this property has no effect.
`tintColor` is initially nil, and not setting it leaves the color picker to inherit its tint color in the normal way for iOS 7.
@see -backgroundColor
*/
@property (nonatomic, copy) UIColor *tintColor;

@end

Something went wrong with that request. Please try again.