XXX圆角菜单按钮 1.0.3

XXX圆角菜单按钮 1.0.3

测试已测试
语言语言 Obj-CObjective C
许可证 Apache-2.0
发布最后发布2019年2月

zsy78191维护。



  • 作者:
  • zhangchao

支持CocoaPods。

New at 2019.02.25

  1. 使用@property (nonatomic, assign) BOOL isOpened;可以打开或关闭RoundMenu

  2. 使用-(void)setButtonEnable:(BOOL)enable atIndex:(NSUInteger)index;可以配置按钮与RoundMenu

New at 2017.5.11

菜单打开后添加偏移。

self.roundMenu2.offsetAfterOpened = CGSizeMake(-80, -80);

preview

New at 6.16

  1. 添加功能以设置自定义图片作为中心按钮图标。
  2. 添加Swift示例。

CocoaPods

pod 'XXXRoundMenuButton'

XXXRoundMenuButton

一个简单的圆形菜单控件。设计灵感来自InVision团队的 Anton Aheichanka的Filter MenuAnton Aheichanka的Secret Project

一个简单的圆形风格菜单。设计灵感来自 Anton Aheichanka的Filter MenuAnton Aheichanka的Secret Project

preview

Angle

/**
*  config function
*
*  @param icons        array of UIImages
*  @param degree       start degree
*  @param layoutDegree angle span
*/
- (void)loadButtonWithIcons:(NSArray<UIImage*>*)icons startDegree:(CGFloat)degree layoutDegree:(CGFloat)layoutDegree;

startDegree 0 度是⬇️,layoutDegree 是起始和结束方向之间的范围,逆时针

Update

2016.4.19修复了XXXRoundMenuButton无法传递触摸事件的问题

易于使用界面

self.roundMenu.centerButtonSize = CGSizeMake(44, 44);
self.roundMenu.centerIconType = XXXIconTypeUserDraw;
self.roundMenu.tintColor = [UIColor whiteColor];
self.roundMenu.jumpOutButtonOnebyOne = YES;

[self.roundMenu setDrawCenterButtonIconBlock:^(CGRect rect, UIControlState state) {

if (state == UIControlStateNormal)
{
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 - 5, 15, 1)];
[UIColor.whiteColor setFill];
[rectanglePath fill];


UIBezierPath* rectangle2Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2, 15, 1)];
[UIColor.whiteColor setFill];
[rectangle2Path fill];

UIBezierPath* rectangle3Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 + 5, 15, 1)];
[UIColor.whiteColor setFill];
[rectangle3Path fill];
}
}];

[self.roundMenu loadButtonWithIcons:@[
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"],
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"],
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"]

] startDegree:0 layoutDegree:M_PI*2*7/8];

[self.roundMenu setButtonClickBlock:^(NSInteger idx) {

NSLog(@"button %@ clicked !",@(idx));
}];


/**
*  RoundMenu2 config
*/
[self.roundMenu2 loadButtonWithIcons:@[
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"]

] startDegree:-M_PI layoutDegree:M_PI/2];
[self.roundMenu2 setButtonClickBlock:^(NSInteger idx) {

NSLog(@"button %@ clicked !",@(idx));
}];

self.roundMenu2.tintColor = [UIColor whiteColor];

self.roundMenu2.mainColor = [UIColor colorWithRed:0.13 green:0.58 blue:0.95 alpha:1];