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

笔者平常也要使用这些工具,但总是不好找到一个方便可高度自定义的,所以自己制作了一个

这里写图片描述

使用方法:

简单使用
- (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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值