WGBCustomPopUpView
示例
图片仅供参考,具体请看代码 图片廉价,演示代码较好
效果 | 预览图 |
---|---|
示例1打赏弹窗 | ![]() |
示例2引导弹窗 | ![]() |
示例3提示消息 | ![]() |
示例4系统Alert封装 | ![]() |
示例5系统AlertSheet封装 | ![]() |
要运行示例项目,请先克隆仓库,然后在示例目录中运行 pod install
用法
//实例化
WGBCustomPopUpView *popUpView = [[WGBCustomPopUpView alloc] init];
UIView *bgView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
bgView.userInteractionEnabled = YES;
bgView.backgroundColor = [UIColor clearColor] ;
UIView *redView = [[UIView alloc] init];
redView.frame = CGRectMake(0,kScreenHeight-200,375,200);
redView.backgroundColor =[UIColor redColor];
redView.center = CGPointMake(bgView.frame.size.width/2, bgView.frame.size.height/2);
[bgView addSubview: redView];
/// 以下三行才是关键代码
popUpView.contentView = redView; //设置内容视图
popUpView.animationType = arc4random()%6; //设置弹窗动画类型 随机枚举值
[popUpView show]; // 弹出来瞧瞧
// 必要的时候消除弹窗
popUpView.touchDismiss = YES;
[popUpView dismiss];
需求
安装
WGBCustomPopUpView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
pod 'WGBCustomPopUpView',‘~>1.0.1’
作者
许可协议
WGBCustomPopUpView 在MIT许可下可用。有关更多信息,请参阅LICENSE文件。