Procházet zdrojové kódy

修改锁界面前景色设置。

Pen Li před 9 roky
rodič
revize
651e6b1ebc

binární
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 5 - 0
RedAnt ERP Mobile/iSales-NPD/JKLock/JKDotView.h

@@ -17,4 +17,9 @@ typedef NS_ENUM(NSUInteger, JKDotState) {
 
 @property (nonatomic,assign) JKDotState state;
 
+@property (nonatomic,strong) UIColor *strokColor;
+@property (nonatomic,strong) UIColor *fillColor;
+
+- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor fillColor:(UIColor *)fillColor;
+
 @end

+ 24 - 4
RedAnt ERP Mobile/iSales-NPD/JKLock/JKDotView.m

@@ -20,7 +20,7 @@
 -(CAShapeLayer *)inscribedCircleLayer{
     if (!_inscribedCircleLayer) {
         _inscribedCircleLayer = [CAShapeLayer layer];
-        _inscribedCircleLayer.strokeColor = [UIColor blackColor].CGColor;
+        _inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
         _inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
         _inscribedCircleLayer.lineWidth = 1.0f;
     }
@@ -43,18 +43,31 @@
     return self;
 }
 
+- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor fillColor:(UIColor *)fillColor {
+    if (self = [super initWithFrame:frame]) {
+        
+        self.strokColor = strokColor;
+        self.fillColor = fillColor;
+        
+        self.backgroundColor = [UIColor clearColor];
+        [self.layer setNeedsDisplay];
+        
+    }
+    return self;
+}
+
 - (void)setState:(JKDotState)state {
     _state = state;
     
     switch (state) {
         case JKDotStateNormal:{
-            _inscribedCircleLayer.strokeColor = [UIColor blackColor].CGColor;
+            _inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
             _inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
         }
             break;
         case JKDotStateSelected:{
-            _inscribedCircleLayer.strokeColor = [UIColor blackColor].CGColor;
-            _inscribedCircleLayer.fillColor = [UIColor blackColor].CGColor;
+            _inscribedCircleLayer.strokeColor = self.fillColor.CGColor;
+            _inscribedCircleLayer.fillColor = self.fillColor.CGColor;
         }
             break;
             
@@ -63,6 +76,13 @@
     }
 }
 
+- (UIColor *)strokColor {
+    return _strokColor ? _strokColor : [UIColor blackColor];
+}
+
+- (UIColor *)fillColor {
+    return _fillColor ? _fillColor : [UIColor blackColor];
+}
 
 
 @end

+ 5 - 0
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockButton.h

@@ -14,5 +14,10 @@
 
 @property (nonatomic,assign) NSInteger number;
 
+@property (nonatomic,strong) UIColor *strokColor;
+@property (nonatomic,strong) UIColor *fillColor;
+@property (nonatomic,strong) UIColor *highlightColor;
+
+- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor highlightColor:(UIColor *)highlightColor;
 
 @end

+ 26 - 4
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockButton.m

@@ -34,7 +34,7 @@
 -(CAShapeLayer *)inscribedCircleLayer{
     if (!_inscribedCircleLayer) {
         _inscribedCircleLayer = [CAShapeLayer layer];
-        _inscribedCircleLayer.strokeColor = [UIColor lightGrayColor].CGColor;
+        _inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
         _inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
         _inscribedCircleLayer.lineWidth = 1.0f;
     }
@@ -63,6 +63,16 @@
     
 }
 
+- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor highlightColor:(UIColor *)highlightColor {
+    if (self = [super initWithFrame:frame]) {
+        self.strokColor = strokColor;
+        self.highlightColor = highlightColor;
+        [self.layer setNeedsDisplay];
+        [self.inscribedCircleLayer addSublayer:self.titleLabel.layer];
+    }
+    return self;
+}
+
 - (instancetype)initWithFrame:(CGRect)frame {
     if (self = [super initWithFrame:frame]) {
         [self.layer setNeedsDisplay];
@@ -76,8 +86,8 @@
 }
 
 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
-    self.inscribedCircleLayer.strokeColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5].CGColor;
-    self.inscribedCircleLayer.fillColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5].CGColor;
+    self.inscribedCircleLayer.strokeColor = self.highlightColor.CGColor;
+    self.inscribedCircleLayer.fillColor = self.highlightColor.CGColor;
     
     NSSet *allTargets = self.allTargets;
     
@@ -89,9 +99,21 @@
 }
 
 - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
-    self.inscribedCircleLayer.strokeColor = [UIColor lightGrayColor].CGColor;
+    self.inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
     self.inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
 }
 
+- (UIColor *)highlightColor {
+    return _highlightColor ? _highlightColor : [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5];
+}
+
+- (UIColor *)strokColor {
+    return _strokColor ? _strokColor : [UIColor lightGrayColor];
+}
+
+- (UIColor *)fillColor {
+    return _fillColor ? _fillColor : self.highlightColor;
+}
+
 
 @end

+ 11 - 0
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockController.h

@@ -14,6 +14,17 @@ typedef void(^authoBlock)(BOOL failure);
 
 @property (nonatomic,copy) authoBlock authoReturn;
 
+#pragma mark - color
+
+@property (nonatomic,strong) UIColor *backgroundColor;
+@property (nonatomic,strong) UIColor *dotStrokColor;
+@property (nonatomic,strong) UIColor *dotFillColor;
+@property (nonatomic,strong) UIColor *lockStrokColor;
+//@property (nonatomic,strong) UIColor *lockFillColor;
+@property (nonatomic,strong) UIColor *lockHighlightColor;
+
+#pragma mark - method
+
 - (void)setPasswordKey:(NSString *)passwordKey;
 
 @end

+ 20 - 3
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockController.m

@@ -33,10 +33,23 @@
     _passwordKey = passwordKey;
 }
 
+- (instancetype)init {
+    if (self = [super init]) {
+        self.backgroundColor = [UIColor colorWithRed:0.5 green:0.8 blue:0.6 alpha:1];
+        
+        self.dotStrokColor = [UIColor redColor];
+        self.dotFillColor = [UIColor yellowColor];
+        
+        self.lockStrokColor = [UIColor greenColor];
+        self.lockHighlightColor = [UIColor purpleColor];
+    }
+    return self;
+}
+
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    self.view.backgroundColor = [UIColor colorWithRed:0.5 green:0.8 blue:0.6 alpha:1];
+    self.view.backgroundColor = self.backgroundColor;
         
     self.index = 0;
     self.input = @"";
@@ -81,7 +94,7 @@
     CGFloat y1 = y0 + CGRectGetHeight(self.tipLabel.bounds) + 20; // 间距20,高度20
     CGFloat x1 = (width - Dot_Width * Password_Length - Dot_Interval * (Password_Length - 1)) / 2;
     for (int i = 0; i < Password_Length; i++) {
-        JKDotView *dot = [[JKDotView alloc] initWithFrame:CGRectMake(x1 + (Dot_Width + Dot_Interval) * i, y1, Dot_Width, Dot_Width)];
+        JKDotView *dot = [[JKDotView alloc] initWithFrame:CGRectMake(x1 + (Dot_Width + Dot_Interval) * i, y1, Dot_Width, Dot_Width) strokColor:self.dotStrokColor fillColor:self.dotFillColor];
         
         [self.view addSubview:dot];
         [self.dotArray addObject:dot];
@@ -105,6 +118,7 @@
                 cancelBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
                 [cancelBtn setTitle:@"cancel" forState:UIControlStateNormal];
                 [cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+                [cancelBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
                 [cancelBtn addTarget:self action:@selector(cancelButtonClick:) forControlEvents:UIControlEventTouchUpInside];
                 [self.view addSubview:cancelBtn];
                 
@@ -114,11 +128,14 @@
                 deleteBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
                 [deleteBtn setTitle:@"delete" forState:UIControlStateNormal];
                 [deleteBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+                [deleteBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
                 [deleteBtn addTarget:self action:@selector(deleteButtonClick:) forControlEvents:UIControlEventTouchUpInside];
                 [self.view addSubview:deleteBtn];
                 
             } else { // 数字
-                JKLockButton *btn = [[JKLockButton alloc] initWithFrame:CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width)];
+                JKLockButton *btn = [[JKLockButton alloc] initWithFrame:CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width) strokColor:self.lockStrokColor highlightColor:self.lockHighlightColor];
+
+                
                 if (i == 1 && j == 3) {
                     btn.number = 0;
                 } else {