iOS颜色选择器:CHColorPickerView

jopen 11年前

CHColorPickerView 是 iOS 非常容易使用的颜色选择器,只有一个委托方法,支持 iPhone 和 iPad。

用法

  • Refer to the Demo project.
  • Drag and Drop CHColorPicker.h/.m into your project
  • Implement the delegate method in your ViewController

使用 ColorPicker (示例)

    colorPickerView = [[CHColorPickerView alloc] init];          // 1. Setup delegate (Implement delegate methods)        colorPickerView.delegate = self;            // 2. Setup desired behaviour        colorPickerView.colorsPerRow = 4;      colorPickerView.colorCellPadding = 2.0;        colorPickerView.highlightSelection = YES;      colorPickerView.selectionBorderColor = [UIColor whiteColor];          // 3. Set colors that should be available as an NSArray        [colorPickerView setColors:[self createDemoColor]];          // 4 Do some styling        colorPickerView.backgroundColor = [UIColor colorWithHexString:@"1d2225"];          // 5. add to view hierachy        [self.view addSubview:colorPickerView];

实现 delegate

    -(void)colorPickerView:(CHColorPickerView *)colorPickerView didSelectColor:(UIColor *)color; 

iOS颜色选择器:CHColorPickerView

项目主页:http://www.open-open.com/lib/view/home/1406105496882