|
@@ -14,6 +14,9 @@
|
|
|
NSString *cancelTitleStr;
|
|
|
NSString *okTitleStr;
|
|
|
BOOL isOkBtnHighlight;
|
|
|
+
|
|
|
+ CommonAlert_ClickOkBtn didClickOkBtn;
|
|
|
+ CommonAlert_ClickCancelBtn didClickCanaelBtn;
|
|
|
}
|
|
|
|
|
|
@end
|
|
@@ -21,7 +24,7 @@
|
|
|
@implementation ComontAlretViewController
|
|
|
@synthesize delegate;
|
|
|
|
|
|
-- (id)initWithTiTle:(NSString *)title msg:(NSString *)msg cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle isOkBtnHighlight:(BOOL)okBtnHighlight;{
|
|
|
+- (id)initWithTiTle:(NSString *)title msg:(NSString *)msg cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle isOkBtnHighlight:(BOOL)okBtnHighlight didClickOk:(CommonAlert_ClickOkBtn)ok didClickCancel:(CommonAlert_ClickCancelBtn)Cancel{
|
|
|
self = [super init];
|
|
|
|
|
|
titleStr = title;
|
|
@@ -29,6 +32,9 @@
|
|
|
cancelTitleStr = cancelTitle;
|
|
|
okTitleStr = okTitle;
|
|
|
isOkBtnHighlight = okBtnHighlight;
|
|
|
+
|
|
|
+ didClickOkBtn = ok;
|
|
|
+ didClickCanaelBtn = Cancel;
|
|
|
return self;
|
|
|
}
|
|
|
|
|
@@ -145,8 +151,6 @@
|
|
|
make.bottom.equalTo(bgView.mas_bottom).offset(-30.f);
|
|
|
make.height.mas_equalTo(48.f);
|
|
|
}];
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
if (okTitleStr.length > 0){
|
|
@@ -191,8 +195,12 @@
|
|
|
- (void)cancelBtnClick{
|
|
|
[self dismissViewControllerAnimated:YES completion:^{
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- if ([self->delegate respondsToSelector:@selector(cancelBtnClickPressed)]){
|
|
|
- [self->delegate cancelBtnClickPressed];
|
|
|
+ if ([self->delegate respondsToSelector:@selector(CommonAlertCancelBtnClickPressed)]){
|
|
|
+ [self->delegate CommonAlertCancelBtnClickPressed];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(self->didClickCanaelBtn){
|
|
|
+ self->didClickCanaelBtn();
|
|
|
}
|
|
|
});
|
|
|
}];
|
|
@@ -201,8 +209,12 @@
|
|
|
- (void)okBtnClick{
|
|
|
[self dismissViewControllerAnimated:YES completion:^{
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- if ([self->delegate respondsToSelector:@selector(okBtnClickPressed)]){
|
|
|
- [self->delegate okBtnClickPressed];
|
|
|
+ if ([self->delegate respondsToSelector:@selector(CommonAlertokBtnClickPressed)]){
|
|
|
+ [self->delegate CommonAlertokBtnClickPressed];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(self->didClickOkBtn){
|
|
|
+ self->didClickOkBtn();
|
|
|
}
|
|
|
});
|
|
|
}];
|