用UIViewController实现的自定义弹出框
效果图如下
- 使用
cocoapodsPodfile文件中添加pod 'ZLPopMenuViewController' - 也可以直接把代码拖到工程中
- 在
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)- 在
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);
}];欢迎大家随意改样式。
