图片仅供参考,具体还是看代码比较好
pic is cheap , show the code
效果 | 预览图 |
---|---|
示例1打赏弹窗 | |
示例2引导弹窗 | |
示例3提示消息 | |
示例4系统Alert封装 | |
示例5系统AlertSheet封装 |
To run the example project, clone the repo, and run pod install
from the Example directory first.
//实例化
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 is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'WGBCustomPopUpView',‘~>1.0.1’
Wangguibin, [email protected]
WGBCustomPopUpView is available under the MIT license. See the LICENSE file for more info.