美文网首页
封装类似iPad中的UIPopoverController工具类

封装类似iPad中的UIPopoverController工具类

作者: 93b3d3ccb7e6 | 来源:发表于2016-09-28 21:24 被阅读47次
效果:
0928_1.gif
思路:
  • 先创建一个透明的背景视图,再创建一个tableView添加到透明的背景视图上面,然后把tableView的didSelectRowAtIndexPath方法封装成一个block回调。
用法:
    NSArray *titles = @[@"添加好友",@"多人会话",@"扫一扫"];
    NSArray *icons = @[@"right_menu_addFriend",@"right_menu_multichat",@"right_menu_QR"];
    self.popoverView = [[HWPopoverView alloc] initWithTitles:titles icons:icons style:HWPopoverViewStyleRightTop didSelectCallBack:^(NSInteger selectIndex) {
        NSLog(@"-->> selectIndex:%ld", (long)selectIndex);
    }];
安装:
  • 下载此Demo之后,拖动HWPopoverView文件夹到项目中,导入HWPopoverView.h
  • 此工具类依赖Masonry,使用前请确保已安装Masonry。

Demo链接:https://github.com/hw20101101/HWPopoverViewDemo

相关文章

网友评论

      本文标题:封装类似iPad中的UIPopoverController工具类

      本文链接:https://www.haomeiwen.com/subject/ywhkyttx.html