Browse Source

部分点击选中效果

桂欢 1 năm trước cách đây
mục cha
commit
da4e693449

+ 2 - 0
SLAiELTS/SLAiELTS/AppMarcos/GlobalDefines.h

@@ -38,6 +38,8 @@
 #define TimeLineCellHighlightedColor [UIColor colorWithRed:92/255.0 green:140/255.0 blue:193/255.0 alpha:1.0]
 
 
+#define SLColSel SDColor(199, 198, 205, 1)
+
 #define SLCol205 SDColor(205, 205, 205, 1)
 
 #define DAY @"day"

+ 14 - 3
SLAiELTS/SLAiELTS/Tool/Views/SLCustomizeAlert.m

@@ -26,7 +26,12 @@
 {
     if (self.alertClick) {
         self.alertClick(btn.tag - 6688);
-        [self removeFromSuperview];
+        [UIView animateWithDuration:0.2 animations:^{
+            btn.backgroundColor = SLColSel;
+        }];
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            [self removeFromSuperview];
+        });
     }
 }
 
@@ -253,8 +258,12 @@
         make.height.equalTo(@(0.0));
     }];
     
-    self.sureBtn.backgroundColor = SLBlueColor;
-    self.cancelBtn.backgroundColor = [SLBlueColor colorWithAlphaComponent:0.1];
+    [self.sureBtn setBackgroundImage:ImageName(@"icon_btn_blue") forState:UIControlStateNormal];
+    [self.sureBtn setBackgroundImage:ImageName(@"icon_btn_blue_sel") forState:UIControlStateHighlighted];
+    UIImage *blueImg = [UIImage imageWithColor:[SLBlueColor colorWithAlphaComponent:0.1] size:CGSizeMake(110, 50)];
+    UIImage *blueSelImg = [UIImage imageWithColor:[SLBlueSelColor colorWithAlphaComponent:0.1] size:CGSizeMake(110, 50)];
+    [self.cancelBtn setBackgroundImage:blueImg forState:UIControlStateNormal];
+    [self.cancelBtn setBackgroundImage:blueSelImg forState:UIControlStateHighlighted];
     if (!hasCancelBtn) {
         [self.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(self.lineView.mas_bottom);
@@ -448,6 +457,7 @@
     if (!_sureBtn) {
         _sureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
         _sureBtn.titleLabel.font = [UIFont systemFontOfSize:16];
+        _sureBtn.clipsToBounds = YES;
         [_sureBtn setTitleColor:SLColor(@"#EB2B2B") forState:UIControlStateNormal];
         [_sureBtn addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside];
         [self.alertView addSubview:_sureBtn];
@@ -460,6 +470,7 @@
     if (!_cancelBtn) {
         _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
         _cancelBtn.titleLabel.font = [UIFont systemFontOfSize:16];
+        _cancelBtn.clipsToBounds = YES;
         [_cancelBtn setTitleColor:SLColor(@"#333333") forState:UIControlStateNormal];
         [_cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside];
         [self.alertView addSubview:_cancelBtn];

+ 1 - 1
SLAiELTS/SLAiELTS/ViewControllers/MyVC/Views/Cells/SLMyListCollectionViewCell.m

@@ -26,7 +26,7 @@
         WS(weakSelf);
         __block SLBaseCellView *blockBaseCell = baseCell;
         [baseCell addTapWithBlock:^{
-            blockBaseCell.contentView.backgroundColor = [UIColor colorWithRed:199 / 255.0 green:198 / 255.0 blue:205 / 255.0 alpha:1.0];
+            blockBaseCell.contentView.backgroundColor = SLColSel;
             [UIView animateWithDuration:0.5 animations:^{
                 blockBaseCell.contentView.backgroundColor = [UIColor whiteColor];
             }];

+ 1 - 1
SLAiELTS/SLAiELTS/ViewControllers/RoleLabelVC/Views/SLRoleLabelView.m

@@ -168,7 +168,7 @@
 
 - (void)confignWithRoleLanguage {
     UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-    cancelBtn.backgroundColor = [UIColor colorWithRed:199 / 255.0 green:235 / 255.0 blue:253 / 255.0 alpha:1];
+    cancelBtn.backgroundColor = SLColSel;
     [cancelBtn setTitle:@"试听语音" forState:UIControlStateNormal];
     [cancelBtn setTitleColor:SLColor(@"#1677FF") forState:UIControlStateNormal];
     cancelBtn.layer.borderColor = [SLBlueColor CGColor];