一个仿系统(UIMenuController
)的自定义选择菜单项,实现了纯文本、图文、自定义View等展示样式,你也可以很方便的扩展实现自己的样式【例如微信、钉钉、QQ等聊天界面长按的样式】
-
在Podfile文件中添加
target 'YouProject' do pod 'XMMenuPopover' end
-
命令行执行
pod repo update master
pod install
PS: 更多样式请查看demo
XMMenuPopover *menu = [XMMenuPopover sharedMenuPopover];
menu.style = XMMenuStyleSystem;
XMMenuItem *item1 = [[XMMenuItem alloc] initWithTitle:@"复制" actionHandler:^{
NSLog(@"88");
}];
XMMenuItem *item2 = [[XMMenuItem alloc] initWithTitle:@"添加到收藏夹" target:self action:@selector(clickAction)];
XMMenuItem *item3 = [[XMMenuItem alloc] initWithTitle:@"发送给好友" target:self action:@selector(clickAction)];
menu.menuItems = @[item1,item2,item3];
[menu showMenuFromView:targetView rect:targetView.bounds animated:YES];
You are welcome to fork and submit pull requests.
XMMenuPopover is open-sourced software licensed under the MIT license.