// // ShowKeepNoticeAlert.m // smartRhino // // Created by armin on 2019/11/6. // Copyright © 2019 tederen. All rights reserved. // #import "ShowKeepNoticeAlert.h" @interface ShowKeepNoticeAlert() @property (strong,nonatomic) IBOutlet UIView *contentBgView; @property (copy, nonatomic) void(^confirmBlock)(void); @property (copy, nonatomic) void(^cancelBlock)(ShowKeepNoticeCloseType colseType); @end @implementation ShowKeepNoticeAlert static UINib *ViewNib = nil; + (instancetype)selectView{ if (ViewNib == nil) { ViewNib = [UINib nibWithNibName:@"ShowKeepNoticeAlert" bundle:nil]; } ShowKeepNoticeAlert *alert = [[ViewNib instantiateWithOwner:nil options:nil] lastObject]; return alert; } /** * 初始化 */ +(instancetype)initShowKeepNoticeAlertConfirm:(void (^)(void))confirmBlock cancle:(void (^)(ShowKeepNoticeCloseType closeType))cancleBlock{ ShowKeepNoticeAlert *alert = [self selectView]; [alert setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; alert.contentBgView.backgroundColor = [UIColor whiteColor]; alert.contentBgView.width = SCREEN_WIDTH - 2*55; [alert.contentBgView setRadius:8 corners:UIRectCornerAllCorners]; [alert setStatusBarStyle:UIStatusBarStyleDefault]; [alert setGesture:YES]; [alert setConfirmBlock:confirmBlock]; [alert setCancelBlock:cancleBlock]; return alert; } -(IBAction)userDidBackClickAction:(id)sender{ UIButton *btn = (id)sender; [self dismissWithAnimation:kAlertAnimationBottom]; if(btn.tag == 11){ //放弃 if(self.cancelBlock){ self.cancelBlock(ShowKeepNoticeCloseType1); } }else if (btn.tag == 12){ //关闭 if(self.cancelBlock){ self.cancelBlock(ShowKeepNoticeCloseType2); } } } -(IBAction)userDidSureClickAction:(id)sender{ [self dismissWithAnimation:kAlertAnimationBottom]; if(self.confirmBlock){ self.confirmBlock(); } } @end