AlphaColorPicker 0.0.1

AlphaColorPicker 0.0.1

测试已测试
语言语言 Obj-CObjective C
许可证 Apache 2
发布日期最新发布日期2015年6月

panyam维护。



  • 作者
  • Neovera

颜色选择器

背景

在iOS库中,苹果提供的一系列内置控件中最显眼缺失的一个就是颜色选择器。许多开源组件应运而生以填补这一空白。这个组件是为了[ToonThat][https://itunes.apple.com/us/app/toonthat/id584478951?ls=1&mt=8]应用程序而创建的,因为我们没有在其他工具中找到类似的灵活性和功能集。

屏幕截图

Simple selector Hue Grid selector HSL selector

功能

  • 显示简单的颜色板(简化了简单情况)。
  • 适配iPhone 5 - 颜色板扩展以填充更大的屏幕。
  • 色相网格 - 更多的主色变体。底部颜色行可以点击选择颜色,或可以左右滑动网格。
  • HSL选择器 - 进行精细颜色选择,显示色相圆和分离的饱和度和亮度控制。
  • 透明度选择器
  • 允许用户保存他们喜欢的颜色。收藏夹存储在Documents目录下的文件中。
  • 简单的代理模型。
  • 您可以指定当前颜色选择和标题。

使用方法

将源文件夹中的文件复制到您的项目中。colorPicker.bundle文件包含图形资源。

在您想要调用颜色选择器的视图控制器中,首先实现代理的方法

@implementation MyViewController <NEOColorPickerViewControllerDelegate>

假设您希望在按钮被点击后启动视图控制器,设置并启动一个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];

最后处理颜色选择器代理回调,在颜色被选择或取消时

- (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];
}

许可证

Apache License 2.0