您的位置:首页 > 运维架构

方便的弹出视图,可随意定义箭头方向,自动计算位置

2016-06-23 17:09 399 查看
笔者平常也要使用这些工具,但总是不好找到一个方便可高度自定义的,所以自己制作了一个



使用方法:

简单使用
- (instancetype)initWithFrame:(CGRect)frame
andDirection:(PopViewDirection)direction
andTitles:(NSArray *)titles;


自定义使用
- (instancetype)initWithFrame:(CGRect)frame
andDirection:(PopViewDirection)direction
andTitles:(NSArray *)titles
andImages:(NSArray *)images
trianglePecent:(float)percent;

SimplePopupView *popView = [[SimplePopupView alloc]initWithFrame:CGRectMake(50, 50, 120, 80) andDirection:PopViewDirectionRight andTitles:tmpArray andImages:images trianglePecent:0.5];


//1.直接加入指定位置
SimplePopupView *popView = [[SimplePopupView alloc]initWithFrame:CGRectMake(50, 50, 120, 80) andDirection:PopViewDirectionRight andTitles:tmpArray];

[self.view addSubview:popView];
//响应事件中调用show方法
[popView show];


//2.调用UIView+SimplePopupView中方法
SimplePopupView *popView0 = [[SimplePopupView alloc]initWithFrame:CGRectMake(50, 50, 120, 80) andDirection:PopViewDirectionRight andTitles:tmpArray andImages:images trianglePecent:0.5]; //箭头位于popview右边缘中间0.5位置

[_button showPopView:popView0 AtPoint:CGPointMake(0, 0.5)];//箭头位于button的x=0.y=0.5比例处
//然后响应事件中调用show方法
[popView0 show];

//这样popview就会显示在button的设置位置


demo下载:https://github.com/shengpeng3344/SimplePopView
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  popupview 弹出视图