要运行示例项目,请克隆仓库,然后首先从 Example 目录中运行 pod install
EMEmojiableBtn 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中:
pod "EMEmojiableBtn"
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];
使用此实例可以完全自定义组件。根据 EMEmojiableBtnConfig 变量。
您可以使用以下变量来自定义选择器,用于:
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];
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 文件。