CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Apache 2 |
ReleasedLast Release | Jun 2015 |
Maintained by panyam.
A color picker is the most conspicuously absent component in the collection of built-in controls provided by Apple in the iOS library. There are many open-source components that have sprung up to fill the gap. This component was created for the [ToonThat][https://itunes.apple.com/us/app/toonthat/id584478951?ls=1&mt=8] application as we didn't find the level of flexibility and feature-set in the others.
Copy the files within the Source folder into your project. The colorPicker.bundle file contains the graphical resources.
In your view controller where you want to invoke the color picker, first implement the methods of the delegate:
@implementation MyViewController <NEOColorPickerViewControllerDelegate>
Assuming you want to launch the view controller in response to a button being clicked, setup and launch an instance of NEOColorPickerViewController:
NEOColorPickerViewController *controller = [[NEOColorPickerViewController alloc] init];
controller.delegate = self;
controller.selectedColor = <some initial color reference>;
controller.title = @"My dialog title";
UINavigationController* navVC = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentViewController:navVC animated:YES completion:nil];
Finally handle the color picker delegate callback when the color is selected or cancelled:
- (void) colorPickerViewController:(NEOColorPickerBaseViewController *)controller didSelectColor:(UIColor *)color {
// Do something with the color.
self.view.backgroundColor = color;
[controller dismissViewControllerAnimated:YES completion:nil];
}
- (void) colorPickerViewControllerDidCancel:(NEOColorPickerBaseViewController *)controller {
[controller dismissViewControllerAnimated:YES completion:nil];
}