ZLPopMenuViewController
使用UIViewController实现的自定义弹出框
效果图如下
安装
- 使用
cocoapods
和Podfile
文件,在其中添加pod 'ZLPopMenuViewController'
- 或者直接将代码拖到您的项目中
使用
Swift
- 在
viewControll
中添加import ZLPopMenuViewController
let datas1: [ZLPopMenuModel] = [.init(itemName: "首页(4)"),
.init(itemName: "首页"),
.init(itemName: "确认")]
let popVC = ZLPopMenuViewController.init(sourceView: sender, menuData: datas1)
popVC.didClickItems = {(index, model)in
}
present(popVC, animated: true, completion: nil)
Objective-C
- 在
viewControll中
添加#import <ZLPopMenuViewController/ZLPopMenuViewController-Swift.h>
ZLPopMenuModel *model = [[ZLPopMenuModel alloc]initWithItemName:@"菜单" imageName:nil];
ZLPopMenuViewController *popVC =[[ZLPopMenuViewController alloc] initWithSourceView:testView
menuData:@[model, model, model]
menuStyle:ZLPopMenuStyleWhite
popMenuConfig:[ZLPopMenuConfig default]];
[self presentViewController:popVC animated:true completion:nil];
[popVC setDidClickItems:^(NSInteger indx, ZLPopMenuModel * _Nonnull model) {
NSLog(@"OC中点击了 %ld, %@", indx, model);
}];
欢迎大家自由修改样式。