IOS之使用AwesomeMenu框架令人惊叹的菜单
不要使用cocoaPods,有问题,直接使用文件,4个文件AwesomeMenu.h,AwesomeMenu.m和AwesomeMenuItem.h 和AwesomeMenuItem.m拖入到项目之中。 包含头文件
#import "AwesomeMenu/AwesomeMenu.h"
这里我们引入Masonry框架,使用Masonry自动布局效果。 核心在这里:
#import "AwesomeMenu/AwesomeMenu.h"
#import "ViewController.h"
#import <Masonry/Masonry.h>
@interface ViewController ()<AwesomeMenuDelegate>
@property (nonatomic, strong) AwesomeMenu *pathMenu;
@end
@implementation ViewController
- (void)awesomeMenu:(AwesomeMenu *)menu didSelectIndex:(NSInteger)idx{
NSLog(@"%ld",idx);
}
- (void)viewDidLoad {
[super viewDidLoad];
AwesomeMenuItem *startItem = [[AwesomeMenuItem alloc] initWithImage:[UIImage imageNamed:@"icon_pathMenu_background_normal"] highlightedImage:[UIImage imageNamed:@"icon_pathMenu_background_highlighted"] ContentImage:[UIImage imageNamed:@"icon_pathMenu_mainMine_normal"] highlightedContentImage:[UIImage imageNamed:@"icon_pathMenu_mainMine_highlighted"]];
AwesomeMenuItem *item0 = [[AwesomeMenuItem alloc]
initWithImage:[UIImage imageNamed:@"bg_pathMenu_black_normal"]
highlightedImage:nil
ContentImage:[UIImage imageNamed:@"icon_pathMenu_mainMine_normal"]
highlightedContentImage:[UIImage imageNamed:@"icon_pathMenu_mainMine_highlighted"]];
AwesomeMenuItem *item1 = [[AwesomeMenuItem alloc]
initWithImage:[UIImage imageNamed:@"bg_pathMenu_black_normal"]
highlightedImage:nil
ContentImage:[UIImage imageNamed:@"icon_pathMenu_collect_normal"]
highlightedContentImage:[UIImage imageNamed:@"icon_pathMenu_collect_highlighted"]];
AwesomeMenuItem *item2 = [[AwesomeMenuItem alloc]
initWithImage:[UIImage imageNamed:@"bg_pathMenu_black_normal"]
highlightedImage:nil
ContentImage:[UIImage imageNamed:@"icon_pathMenu_scan_normal"]
highlightedContentImage:[UIImage imageNamed:@"icon_pathMenu_scan_highlighted"]];
AwesomeMenuItem *item3 = [[AwesomeMenuItem alloc]
initWithImage:[UIImage imageNamed:@"bg_pathMenu_black_normal"]
highlightedImage:nil
ContentImage:[UIImage imageNamed:@"icon_pathMenu_more_normal"]
highlightedContentImage:[UIImage imageNamed:@"icon_pathMenu_more_highlighted"]];
NSArray *items = @[item0, item1, item2, item3];
self.pathMenu = [[AwesomeMenu alloc] initWithFrame:CGRectZero startItem:startItem menuItems:items];
self.pathMenu.menuWholeAngle = M_PI_2;
self.pathMenu.delegate = self;
self.pathMenu.alpha = 0.5;
self.pathMenu.rotateAddButton = NO;
[self.view addSubview:self.pathMenu];
self.pathMenu.startPoint = CGPointMake(0, 0);
[self.pathMenu mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(100);
make.bottom.equalTo(self.view).offset(-100);
}];
}
@end
git 地址 https://gitee.com/johnson__save_admin/iosawesome-menu
|