EMEmojiableBtn 0.1.1

EMEmojiableBtn 0.1.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2016年6月

Erekle Meskhi 维护。



  • Erekle Meskhi

使用方法

要运行示例项目,请克隆仓库,然后首先从 Example 目录中运行 pod install

还有一个由 lojals 开发的 Swift 实现

安装

EMEmojiableBtn 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中:

pod "EMEmojiableBtn"

示例

1. 基础实例

示例代码

EMEmojiableBtn *button = [[EMEmojiableBtn alloc] initWithFrame:CGRectMake(20, 150, 52.0, 52.0)];
button.delegate = self;
button.dataset = @[
    [[EMEmojiableOption alloc] initWithImage:@"img_1" withName:@"dislike"],
    [[EMEmojiableOption alloc] initWithImage:@"img_2" withName:@"broken"],
    [[EMEmojiableOption alloc] initWithImage:@"img_3" withName:@"he he"],
    [[EMEmojiableOption alloc] initWithImage:@"img_4" withName:@"ooh"],
    [[EMEmojiableOption alloc] initWithImage:@"img_5" withName:@"meh !"],
    [[EMEmojiableOption alloc] initWithImage:@"img_6" withName:@"ahh !"]
];
[button setImage:[UIImage imageNamed:@"img_1"] forState:UIControlStateNormal];
[self.view addSubview:button];

image

2. 自定义样式实例

示例代码

使用此实例可以完全自定义组件。根据 EMEmojiableBtnConfig 变量。

您可以使用以下变量来自定义选择器,用于:

image

image

EMEmojiableBtnConfig *config = [[EMEmojiableBtnConfig alloc] init];
config.spacing  = 6.0;
config.size     = 30.0;
config.minSize  = 34.0;
config.maxSize  = 45.0;
config.s_options_selector = 30.0;

EMEmojiableBtn *button = [[EMEmojiableBtn alloc] initWithFrame:CGRectMake(20, 150, 52.0, 52.0) withConfig:config];
button.delegate = self;
button.dataset = @[
    [[EMEmojiableOption alloc] initWithImage:@"img_1" withName:@"dislike"],
    [[EMEmojiableOption alloc] initWithImage:@"img_2" withName:@"broken"],
    [[EMEmojiableOption alloc] initWithImage:@"img_3" withName:@"he he"],
    [[EMEmojiableOption alloc] initWithImage:@"img_4" withName:@"ooh"],
    [[EMEmojiableOption alloc] initWithImage:@"img_5" withName:@"meh !"],
    [[EMEmojiableOption alloc] initWithImage:@"img_6" withName:@"ahh !"]
];
[button setImage:[UIImage imageNamed:@"img_1"] forState:UIControlStateNormal];
[self.view addSubview:button];

image

使用 EMEmojiableBtnConfig 的可用自定义选项

  • size - 每个可用选项的大小
  • maxSize - 选项高亮时的尺寸
  • minSize - 高亮选项时选项的尺寸。当选项高亮时,其他选项更小
  • spacing - 选项之间的间距
  • s_options_selector - 选项选择器视图到按钮和信息视图的底部空间
  • backgroundColor - 在 UILongPressGestureRecognizer 后选项选择器激活时的屏幕背景颜色
  • optionsViewInitialAlpha - 选项列表视图的初始不透明度
  • optionsViewBackgroundColor - 选项列表视图的背景颜色
  • optionsViewShadowColor - 选项列表视图的阴影颜色
  • optionsViewShadowOpacity - 选项列表阴影的不透明度
  • optionsViewShadowOffset - 选项列表阴影的偏移量
  • informationViewBackgroundColor - 信息视图的背景颜色
  • informationViewDotsColor - 信息视图的点颜色
  • informationViewBorderColor - 信息视图的边框颜色
  • informationViewFont - 信息视图的字体
  • informationViewTextColor - 信息视图的文本颜色
  • informationViewText - 信息视图的文本。默认:释放以取消

作者

Erekle, [email protected]

许可证

EMEmojiableBtn 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。