iOS-一个弹出菜单动画视图开源项目分享

来源:互联网 发布:工业设计主流软件 编辑:程序博客网 时间:2024/05/18 12:41

类似于Tumblr发布按钮的弹出视图
使用很简单:

初始化:

@property (nonatomic, strong) XWMenuPopView *myMenuPopView;- (void)viewDidLoad {    [super viewDidLoad]; //将弹出菜单视图添加到主视图    _myMenuPopView = [[XWMenuPopView alloc] initWithFrame:self.view.frame];    [_myMenuPopView setMenuPopDelegate:self];    [self.view addSubview:_myMenuPopView];  }

使用:

#pragma mark - 弹出菜单监听方法-(void)ShowMenuPopView:(UIButton *)menuPopBtn {    [_myMenuPopView showMenu];}

代理

#pragma mark - MenuPopDelegate 代理方法-(void)XWMenuPopView:(XWMenuPopView *)MenuPopView didSelectedMenuIndex:(NSInteger)selectedIndex{    NSLog(@"->>didSelectedMenuIndex->>点击的是第%ld个按钮",selectedIndex);}

备注两点:
/* 如果弹出视图不是在最前端显示,可以 /
// [self.view bringSubviewToFront:_myMenuPopView];
//如果弹出视图是在自定义UITabBarController封装的控制器,需要将 XWMenuPopView 添加在UITabBarController 子视图中

源文件下载:
https://github.com/qxuewei/XWMenuPopView

0 0
原创粉丝点击