Skip to content

通用的弹窗组件,三行代码搞定一个弹窗,支持多种弹出样式

License

Notifications You must be signed in to change notification settings

WangGuibin/WGBCustomPopUpView

Repository files navigation

WGBCustomPopUpView

Example

图片仅供参考,具体还是看代码比较好 pic is cheap , show the code


效果 预览图
示例1打赏弹窗 1
示例2引导弹窗 2
示例3提示消息 3
示例4系统Alert封装 4
示例5系统AlertSheet封装 5

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

//实例化	
  	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];

Requirements

Installation

WGBCustomPopUpView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'WGBCustomPopUpView',~>1.0.1

Author

Wangguibin, [email protected]

License

WGBCustomPopUpView is available under the MIT license. See the LICENSE file for more info.