测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
发布最新版本 | 2015年11月 |
由 Justin Fincher 维护。
JZMultiChoicesCircleButton 是一个多选按钮。
只需轻触并保持即可进行选择!是的,真是太酷了,如此简单。
它的灵感来自 Nicola Felasquez Felaco 的 作品
这是我用 ObjC 实现的 示例,包括演示 gif
要运行示例项目,首先克隆仓库,然后在 Example 目录中运行 pod install
。
#import "JZMultiChoicesCircleButton.h"
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *IconArray = [NSArray arrayWithObjects: [UIImage imageNamed:@"SendRound"],[UIImage imageNamed:@"CompleteRound"],[UIImage imageNamed:@"CalenderRound"],[UIImage imageNamed:@"MarkRound"],nil];
NSArray *TextArray = [NSArray arrayWithObjects: [NSString stringWithFormat:@"Send"],[NSString stringWithFormat:@"Complete"],[NSString stringWithFormat:@"Calender"],[NSString stringWithFormat:@"Mark"], nil];
NSArray *TargetArray = [NSArray arrayWithObjects:[NSString stringWithFormat:@"ButtonOne"],[NSString stringWithFormat:@"ButtonTwo"],[NSString stringWithFormat:@"ButtonThree"],[NSString stringWithFormat:@"ButtonFour"] ,nil];
NewBTN = [[JZMultiChoicesCircleButton alloc] initWithCenterPoint:CGPointMake(self.view.frame.size.width / 2 , self.view.frame.size.height / 2 )
ButtonIcon:[UIImage imageNamed:@"send"]
SmallRadius:30.0f
BigRadius:120.0f
ButtonNumber:4
ButtonIcon:IconArray
ButtonText:TextArray
ButtonTarget:TargetArray
UseParallex:YES
ParallaxParameter:300
RespondViewController:self];
[self.view addSubview:NewBTN];
}
ButtonIcon:UIImage,小按钮中的图标
SmallRadius 和 BigRadius:CGFloat,小按钮的半径以及它动画时的大小
ButtonNumber:int,多少个按钮
ButtonIcon:UIImage 数组
ButtonText:NSString 数组
ButtonTarget:NSString 数组,只是选择符的 String,JZMultiChoicesCircleButton 将使用 NSSelectorFromString 将其转换为 SEL
UseParallex:BOOL,如果 YES,将是 3D 库,如果没有 Parallex 效果,则是 2D
ParallaxParameter:CGFloat,大于 0,越小 Parallex 效果越酷
RespondViewController:应该是 UIViewcontroller,响应者,简单地 'self' 就可以。
- (void)SuccessLoadData
{
[NewBTN SuccessCallBackWithMessage:@"YES!"];
}
- (void)ErrorLoadData
{
[NewBTN FailedCallBackWithMessage:@"NO..."];
}
使用 SuccessCallBackWithMessage 和 FailedCallBackWithMessage 来显示动画信息,或者按钮将 全屏显示且不会消失!
JZMultiChoicesCircleButton 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中
pod "JZMultiChoicesCircleButton"
或者直接从 github 下载 JZMultiChoicesCircleButton.h 和 .m
编辑
[UIImage imageNamed:@"CallbackSuccess" inBundle:bundle compatibleWithTraitCollection:nil];
使用
[UIImage imageNamed:@"CallbackSuccess"];
并下载 CallbackSuccess.png 和 CallbackWrong.png。
1. 使用缩放动画重写,以防止模糊 CATextlayer
Fincher Justin,[email protected]
JZMultiChoicesCircleButton 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。