项目主页: AwesomeMenu 项目主页
实例下载: 最新源代码点击下载
用法简介:
通过创建菜单各个单元项来创建菜单:
UIImage *storyMenuItemImage = [UIImage imageNamed:@"bg-menuitem.png"];
UIImage *storyMenuItemImagePressed = [UIImage imageNamed:@"bg-menuitem-highlighted.png"];
UIImage *starImage = [UIImage imageNamed:@"icon-star.png"];
AwesomeMenuItem *starMenuItem1 = [[AwesomeMenuItem alloc] initWithImage:storyMenuItemImage
highlightedImage:storyMenuItemImagePressed
ContentImage:starImage
highlightedContentImage:nil];
AwesomeMenuItem *starMenuItem2 = [[AwesomeMenuItem alloc] initWithImage:storyMenuItemImage
highlightedImage:storyMenuItemImagePressed
ContentImage:starImage
highlightedContentImage:nil];
// "开始"单元格,类似于 Path 的"添加"按钮.
AwesomeMenuItem *startItem = [[AwesomeMenuItem alloc] initWithImage:[UIImage imageNamed:@"bg-addbutton.png"]
highlightedImage:[UIImage imageNamed:@"bg-addbutton-highlighted.png"]
ContentImage:[UIImage imageNamed:@"icon-plus.png"]
highlightedContentImage:[UIImage imageNamed:@"icon-plus-highlighted.png"]];
然后,初始化菜单和选项:
AwesomeMenu *menu = [[AwesomeMenu alloc] initWithFrame:self.window.bounds startItem:startItem optionMenus:[NSArray arrayWithObjects:starMenuItem1, starMenuItem2]];
menu.delegate = self;
[self.window addSubview:menu];
你也可以使用使用菜单的各个属性,自定义:
重新确定”添加”按钮的位置:
menu.startPoint = CGPointMake(160.0, 240.0);
设置旋转角度:
menu.rotateAngle = 0.0;
设置整个菜单的按钮角度:
menu.menuWholeAngle = M_PI * 2;
设置每个菜单项之间动画延迟执行的时间间隔:
menu.timeOffset = 0.036f;
适应弹动动画:
menu.farRadius = 140.0f;
menu.nearRadius = 110.0f;
设置”添加菜单”与其他菜单单元格之间的距离:
menu.endRadius = 120.0f;