廣告彈窗
阿新 • • 發佈:2018-12-17
匯入HWPopTool.h .m 檔案
@property (strong, nonatomic) UIView *contentView; @property (strong, nonatomic) UIButton *popBtn; 1 2 _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:@"jei"]; [_contentView addSubview:imageV]; // 看看pop效果把下面這一句加上 // [_contentView addSubview:_popBtn]; [HWPopTool sharedInstance].shadeBackgroundType = ShadeBackgroundTypeSolid; [HWPopTool sharedInstance].closeButtonType = ButtonPositionTypeRight; [[HWPopTool sharedInstance] showWithPresentView:_contentView animated:YES]; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - (void)closeAndBack { [[HWPopTool sharedInstance] closeWithBlcok:^{ [self.navigationController popViewControllerAnimated:YES]; }]; }