首先引入HWPoTools.h HWPoTools.m文件
然后在vc.m里面引入#import "HWPopTool.h"头文件
定义属性与方法:
@property (strong, nonatomic) UIView *contentView;
@property (strong, nonatomic) UIButton *popBtn;
再自定义一个方法 [self setn];
再在方法里面写东西
-(void)setn{
self.view.backgroundColor = [UIColor whiteColor];
_contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 300)];
_contentView.backgroundColor = [UIColor clearColor];
_popBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_popBtn.frame = CGRectMake(0, 250, 200, 50);
_popBtn.backgroundColor = [UIColor greenColor];
[_popBtn addTarget:self action:@selector(closeAndBack) forControlEvents:UIControlEventTouchUpInside];
UIImageView *imageV = [[UIImageView alloc]initWithFrame:_contentView.bounds];
imageV.image = [UIImage imageNamed:@"2222"];
[_contentView addSubview:imageV];
// 看看pop效果把下面这一句加上
// [_contentView addSubview:_popBtn];
[HWPopTool sharedInstance].shadeBackgroundType = ShadeBackgroundTypeSolid;
[HWPopTool sharedInstance].closeButtonType = ButtonPositionTypeRight;
[[HWPopTool sharedInstance] showWithPresentView:_contentView animated:YES];
}
-
(void)closeAndBack {
[[HWPopTool sharedInstance] closeWithBlcok:^{
[self.navigationController popViewControllerAnimated:YES];}];
}