類似於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