提交
This commit is contained in:
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong)NSString*message;
|
||||
@property (nonatomic,strong)NSString*cancleTitle;
|
||||
@property (nonatomic,strong)NSString*commitTitle;
|
||||
@property (nonatomic,assign)NSInteger autoDismissTime;
|
||||
@property (nonatomic,assign)BOOL isFromController;
|
||||
@property (nonatomic,copy)void(^commitBlock)(void);
|
||||
@property (nonatomic,copy)void(^cancelBlock)(void);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *cancelBtn;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@end
|
||||
|
||||
@implementation QXCustomAlertView
|
||||
@@ -119,7 +120,28 @@
|
||||
[self.commitBtn setTitle:commitTitle forState:(UIControlStateNormal)];
|
||||
}
|
||||
|
||||
-(void)setAutoDismissTime:(NSInteger)autoDismissTime{
|
||||
if (autoDismissTime > 0) {
|
||||
@weakify(self);
|
||||
__block NSInteger timeCount = autoDismissTime;
|
||||
self.timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
@strongify(self);
|
||||
timeCount--;
|
||||
if (timeCount<=0) {
|
||||
[self.timer invalidate];
|
||||
[self cancelAction];
|
||||
}else{
|
||||
[self.cancelBtn setTitle:[NSString stringWithFormat:@"%@(%ld)",self.cancleTitle,timeCount] forState:(UIControlStateNormal)];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)cancelAction{
|
||||
if (self.timer) {
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
}
|
||||
if (self.isFromController) {
|
||||
if (self.cancelBlock) {
|
||||
self.cancelBlock();
|
||||
@@ -132,6 +154,10 @@
|
||||
[self hide];
|
||||
}
|
||||
-(void)commitAction{
|
||||
if (self.timer) {
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
}
|
||||
if (self.isFromController) {
|
||||
if (self.commitBlock) {
|
||||
self.commitBlock();
|
||||
@@ -152,9 +178,11 @@
|
||||
self.messageLabel.text = message;
|
||||
}
|
||||
if (cancleTitle) {
|
||||
_cancleTitle = cancleTitle;
|
||||
[self.cancelBtn setTitle:cancleTitle forState:(UIControlStateNormal)];
|
||||
}
|
||||
if (commitTitle) {
|
||||
_commitTitle = commitTitle;
|
||||
[self.commitBtn setTitle:commitTitle forState:(UIControlStateNormal)];
|
||||
}
|
||||
CGFloat messageHeight = [message heightForFont:[UIFont systemFontOfSize:13] width:ScaleWidth(275)-1];
|
||||
|
||||
@@ -121,6 +121,10 @@
|
||||
}
|
||||
if ([roomGiftModel.is_cp isEqualToString:@"1"]) {
|
||||
self.cpImageView.hidden = NO;
|
||||
self.cpImageView.image = [UIImage imageNamed:@"room_gift_heart_boom_tag_icon"];
|
||||
}else if ([roomGiftModel.is_teacher isEqualToString:@"1"]) {
|
||||
self.cpImageView.image = [UIImage imageNamed:@"room_gift_teacher_boom_tag_icon"];
|
||||
self.cpImageView.hidden = NO;
|
||||
}else{
|
||||
self.cpImageView.hidden = YES;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user