Просмотр исходного кода

1.修改iOS RedAnt Mobile Result,增加选中色。

Pen Li 8 лет назад
Родитель
Сommit
db8103acbc

+ 1 - 0
common/customUI/ResultCell.h

@@ -20,5 +20,6 @@
 
 @property (nonatomic,weak) id<ResultCellTouchDelegate> touchDelegate;
 @property (nonatomic,assign) BOOL handlingTouch;
+@property (nonatomic,strong) UIColor *touchColor;
 
 @end

+ 14 - 0
common/customUI/ResultCell.m

@@ -9,6 +9,9 @@
 #import "ResultCell.h"
 
 @implementation ResultCell
+{
+    UIColor *_normalBGColor;
+}
 
 - (void)awakeFromNib {
     [super awakeFromNib];
@@ -32,19 +35,30 @@
 }
 
 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
+    if (self.touchColor) {
+        _normalBGColor = self.backgroundColor;
+        self.backgroundColor = self.touchColor;
+    }
+    
+    [super touchesBegan:touches withEvent:event];
     self.handlingTouch = NO;
     [self touch:touches];
 }
 
 - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
+    [super touchesMoved:touches withEvent:event];
     [self touch:touches];
 }
 
 - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
+    self.backgroundColor = _normalBGColor;
+    [super touchesEnded:touches withEvent:event];
     [self touch:touches];
 }
 
 - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
+    self.backgroundColor = _normalBGColor;
+    [super touchesCancelled:touches withEvent:event];
     [self touch:touches];
 }
 

+ 1 - 1
common/customUI/ResultViewController.m

@@ -474,7 +474,7 @@ const int delta = 25;
             x+=width;
         }
         
-        
+        cell.touchColor = [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.4];
 
         if(indexPath.row%2==0)
             cell.backgroundColor=UIColorFromRGB(color0);//[UIColor whiteColor];