封装类似iPad中的UIPopoverController工具类
2016-09-28 本文已影响47人
93b3d3ccb7e6
效果:

思路:
- 先创建一个透明的背景视图,再创建一个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。