It’s generally usable now, so I’ve decided to release it, warts and all. I’ve created a Google Code project for it, bhcolourpicker, where ‘bh’ stands for ‘bunnyhero’ :)
It’s not particularly well-documented at the moment, but that will (hopefully) change.
Here’s an excerpt from the HowTo page on the project site:
To show the colour picker, use code something like the following:
// since it has 'new' in the method name, you own it... BHColourPickerController *vc = [BHColourPickerController newColourPickerController]; vc.delegate = self; // the delegate vc.colour = self.view.backgroundColor; // the initial colour vc.titleText = @"Some kind of title"; // title to display [self presentModalViewController:vc animated:YES]; [vc release]; // ...and must release itYou must implement the
BHColourPickerControllerDelegate
protocol in one of your objects. Implement the following two methods (with examples):
- (void)colourPickerControllerDidCancel:(BHColourPickerController *)controller { // the user just cancelled it; put the picker away [self dismissModalViewControllerAnimated:YES]; } - (void)colourPickerController:(BHColourPickerController *)controller didFinishPickingColour:(UIColor *)colour { // the user confirmed a colour; do something with it self.view.backgroundColor = colour; // and put the picker away [self dismissModalViewControllerAnimated:YES]; }
I’ve released it under a New BSD Licence. Share and enjoy!