Parcourir la source

1.修改iOS Apex Driver导航条样式。

Pen Li il y a 7 ans
Parent
commit
6a7bd1f929

+ 12 - 0
Redant Drivers/Apex And Drivers.xcodeproj/project.pbxproj

@@ -35,6 +35,8 @@
 		420D11262133F7E200149B37 /* RAOrderFilterViewController+DataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D11252133F7E200149B37 /* RAOrderFilterViewController+DataSource.m */; };
 		420D11292133F7F600149B37 /* RAOrderFilterViewController+TableDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D11282133F7F600149B37 /* RAOrderFilterViewController+TableDelegate.m */; };
 		420D112B2133F98600149B37 /* fake_order_filter.json in Resources */ = {isa = PBXBuildFile; fileRef = 420D112A2133F98600149B37 /* fake_order_filter.json */; };
+		421C417621719EB500835447 /* RALoginNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 421C417521719EB500835447 /* RALoginNavigationController.m */; };
+		421C417921719F8100835447 /* RALoginBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 421C417821719F8100835447 /* RALoginBackgroundView.m */; };
 		422BD95C213CE0F300DF8E89 /* HomeHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 422BD95B213CE0F300DF8E89 /* HomeHeader.xib */; };
 		422BD95F213CE2E600DF8E89 /* RABadgeNumberView.m in Sources */ = {isa = PBXBuildFile; fileRef = 422BD95E213CE2E600DF8E89 /* RABadgeNumberView.m */; };
 		422DA1C02134FA7D0021BD70 /* RAPresentationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 422DA1BF2134FA7D0021BD70 /* RAPresentationController.m */; };
@@ -255,6 +257,10 @@
 		420D11272133F7F600149B37 /* RAOrderFilterViewController+TableDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RAOrderFilterViewController+TableDelegate.h"; sourceTree = "<group>"; };
 		420D11282133F7F600149B37 /* RAOrderFilterViewController+TableDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RAOrderFilterViewController+TableDelegate.m"; sourceTree = "<group>"; };
 		420D112A2133F98600149B37 /* fake_order_filter.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = fake_order_filter.json; sourceTree = "<group>"; };
+		421C417421719EB500835447 /* RALoginNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RALoginNavigationController.h; sourceTree = "<group>"; };
+		421C417521719EB500835447 /* RALoginNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RALoginNavigationController.m; sourceTree = "<group>"; };
+		421C417721719F8100835447 /* RALoginBackgroundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RALoginBackgroundView.h; sourceTree = "<group>"; };
+		421C417821719F8100835447 /* RALoginBackgroundView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RALoginBackgroundView.m; sourceTree = "<group>"; };
 		422BD95B213CE0F300DF8E89 /* HomeHeader.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeHeader.xib; sourceTree = "<group>"; };
 		422BD95D213CE2E600DF8E89 /* RABadgeNumberView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RABadgeNumberView.h; sourceTree = "<group>"; };
 		422BD95E213CE2E600DF8E89 /* RABadgeNumberView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RABadgeNumberView.m; sourceTree = "<group>"; };
@@ -551,6 +557,8 @@
 				4205FD4320C0F2C000DB42B4 /* Login.storyboard */,
 				4205FD4620C0F33500DB42B4 /* LoginViewController.h */,
 				4205FD4720C0F33500DB42B4 /* LoginViewController.m */,
+				421C417721719F8100835447 /* RALoginBackgroundView.h */,
+				421C417821719F8100835447 /* RALoginBackgroundView.m */,
 			);
 			name = Login;
 			path = "Apex And Drivers/Login";
@@ -1294,6 +1302,8 @@
 				71EAA33220B9571B002F003C /* AppDelegate.m */,
 				425F1B6A2138F0470031B2C7 /* RANavigationController.h */,
 				425F1B6B2138F0470031B2C7 /* RANavigationController.m */,
+				421C417421719EB500835447 /* RALoginNavigationController.h */,
+				421C417521719EB500835447 /* RALoginNavigationController.m */,
 				4205FD5D20C134B400DB42B4 /* Other */,
 			);
 			path = "Apex And Drivers";
@@ -1504,6 +1514,7 @@
 				4255EC6B20C4E28400E5DA24 /* RADetailActionSelectionViewController+TableDelegate.m in Sources */,
 				4235FAAD213E255D000B6672 /* SignatureViewController.m in Sources */,
 				420D110F2133EEE300149B37 /* RAOrderFilterInputModel.m in Sources */,
+				421C417621719EB500835447 /* RALoginNavigationController.m in Sources */,
 				42529D3C20C0EA3F000C0F4D /* zip.c in Sources */,
 				4259599C21490B6200F7DD41 /* RAOptionCell.m in Sources */,
 				422DA1C02134FA7D0021BD70 /* RAPresentationController.m in Sources */,
@@ -1549,6 +1560,7 @@
 				42D8B8A820C23DD9001C125F /* RAOrderDetailViewController.m in Sources */,
 				42D8B8AE20C245D5001C125F /* RADetailSingleLineCell.m in Sources */,
 				42810FEB20E4C79100315156 /* RAHomeMoreViewController.m in Sources */,
+				421C417921719F8100835447 /* RALoginBackgroundView.m in Sources */,
 				425B97E820C7BF4000B35713 /* ApexDriverUploadListVC.m in Sources */,
 				4255EC6520C4E24500E5DA24 /* RADetailActionSelectionViewController.m in Sources */,
 				4235FA9D213E0F3A000B6672 /* RADetailPhotoCell.m in Sources */,

+ 2 - 1
Redant Drivers/Apex And Drivers/AppDelegate.m

@@ -12,6 +12,7 @@
 #import <CoreLocation/CoreLocation.h>
 #import "RANavigationController.h"
 #import "RAExceptionHandler.h"
+#import "RALoginNavigationController.h"
 
 @interface AppDelegate ()<UNUserNotificationCenterDelegate,CLLocationManagerDelegate>
 
@@ -44,7 +45,7 @@
         [weakSelf showHomeVC];
     };
     
-    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootVC];
+    RALoginNavigationController *nav = [[RALoginNavigationController alloc] initWithRootViewController:rootVC];
     self.window.rootViewController = nav;
 }
 

+ 23 - 0
Redant Drivers/Apex And Drivers/Assets.xcassets/apex_logo.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "apex_logo.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "apex_logo@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "apex_logo@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Redant Drivers/Apex And Drivers/Assets.xcassets/apex_logo.imageset/apex_logo.png


BIN
Redant Drivers/Apex And Drivers/Assets.xcassets/apex_logo.imageset/apex_logo@2x.png


BIN
Redant Drivers/Apex And Drivers/Assets.xcassets/apex_logo.imageset/apex_logo@3x.png


+ 2 - 1
Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m

@@ -157,7 +157,8 @@
 
 - (void)configureNavigationBar {
     
-    UIImage *logo = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
+    UIImage *logo = [[UIImage imageNamed:@"apex_logo"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
+//    UIImage *logo = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
     UIBarButtonItem *logoItem = [[UIBarButtonItem alloc] initWithImage:logo landscapeImagePhone:logo style:UIBarButtonItemStylePlain target:nil action:nil];
 //    logoItem.enabled = NO;
     self.navigationItem.leftBarButtonItem = logoItem;

+ 12 - 5
Redant Drivers/Apex And Drivers/Login/Login.storyboard

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
-        <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -23,6 +22,10 @@
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TW9-L1-cOz" customClass="RALoginBackgroundView">
+                                <rect key="frame" x="0.0" y="20" width="375" height="47"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            </view>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qCw-s3-fQH">
                                 <rect key="frame" x="0.0" y="231.5" width="375" height="140"/>
                                 <subviews>
@@ -108,11 +111,15 @@
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
+                            <constraint firstItem="TW9-L1-cOz" firstAttribute="leading" secondItem="eN5-fH-f6F" secondAttribute="leading" id="0nI-CV-MeI"/>
                             <constraint firstItem="uPR-4Z-qVR" firstAttribute="centerX" secondItem="jSh-rY-8BJ" secondAttribute="centerX" id="5pf-lB-Mm4"/>
                             <constraint firstItem="4nB-rd-0CZ" firstAttribute="top" secondItem="qCw-s3-fQH" secondAttribute="bottom" constant="25" id="6o9-jZ-S21"/>
+                            <constraint firstItem="TW9-L1-cOz" firstAttribute="bottom" secondItem="uPR-4Z-qVR" secondAttribute="top" id="7Rk-ze-vyF"/>
                             <constraint firstItem="hEP-az-ldq" firstAttribute="top" secondItem="6Mm-eS-rAo" secondAttribute="bottom" constant="10" id="8mY-tL-gaO"/>
                             <constraint firstItem="uPR-4Z-qVR" firstAttribute="top" secondItem="hEP-az-ldq" secondAttribute="bottom" constant="20" id="AdB-h2-R13"/>
                             <constraint firstItem="uPR-4Z-qVR" firstAttribute="trailing" secondItem="VlU-9K-g4X" secondAttribute="trailing" id="H1m-mE-RTg"/>
+                            <constraint firstItem="TW9-L1-cOz" firstAttribute="top" secondItem="6Mm-eS-rAo" secondAttribute="bottom" id="HBQ-jg-qvo"/>
+                            <constraint firstItem="eN5-fH-f6F" firstAttribute="trailing" secondItem="TW9-L1-cOz" secondAttribute="trailing" id="IJk-KT-XcP"/>
                             <constraint firstItem="qCw-s3-fQH" firstAttribute="width" secondItem="jSh-rY-8BJ" secondAttribute="width" id="MS5-9p-o7T"/>
                             <constraint firstItem="qCw-s3-fQH" firstAttribute="centerX" secondItem="jSh-rY-8BJ" secondAttribute="centerX" id="ODC-DF-6A9"/>
                             <constraint firstItem="hEP-az-ldq" firstAttribute="leading" secondItem="jSh-rY-8BJ" secondAttribute="leading" constant="20" id="OwY-VO-t5P"/>
@@ -177,7 +184,7 @@
                                 </connections>
                             </textField>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8vH-Bt-vmC">
-                                <rect key="frame" x="47" y="128" width="48" height="30"/>
+                                <rect key="frame" x="47.5" y="128" width="48" height="30"/>
                                 <state key="normal" title="Cancel">
                                     <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 </state>
@@ -186,7 +193,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5lz-8M-zkN">
-                                <rect key="frame" x="297" y="128" width="30" height="30"/>
+                                <rect key="frame" x="297.5" y="128" width="30" height="30"/>
                                 <state key="normal" title="Ok">
                                     <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 </state>

+ 2 - 2
Redant Drivers/Apex And Drivers/Login/LoginViewController.m

@@ -136,9 +136,9 @@
     
     if (self.navigationController && !self.navigationController.isNavigationBarHidden) {
         
-        UIImage *logo = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
+        UIImage *logo = [[UIImage imageNamed:@"apex_logo"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
         UIBarButtonItem *logoItem = [[UIBarButtonItem alloc] initWithImage:logo landscapeImagePhone:logo style:UIBarButtonItemStylePlain target:nil action:nil];
-        logoItem.enabled = NO;
+//        logoItem.enabled = NO;
         self.navigationItem.leftBarButtonItem = logoItem;
     }
 }

+ 17 - 0
Redant Drivers/Apex And Drivers/Login/RALoginBackgroundView.h

@@ -0,0 +1,17 @@
+//
+//  RALoginBackgroundView.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/10/13.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface RALoginBackgroundView : UIView
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 36 - 0
Redant Drivers/Apex And Drivers/Login/RALoginBackgroundView.m

@@ -0,0 +1,36 @@
+//
+//  RALoginBackgroundView.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/10/13.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RALoginBackgroundView.h"
+
+@implementation RALoginBackgroundView {
+    CAGradientLayer *_gradientLayer;
+}
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+ 
+//    _gradientLayer = [CAGradientLayer layer];
+//
+//    UIColor *orangeWhiteColor =  ApexDriverOrangeWhiteColor;
+//    UIColor *orangeColor = ApexDriverOrangeColor;
+//    _gradientLayer.colors = @[(__bridge id)orangeColor.CGColor, (__bridge id)orangeWhiteColor.CGColor];
+//
+//    _gradientLayer.startPoint = CGPointMake(0, 0);
+//    _gradientLayer.endPoint = CGPointMake(1, 0);
+//
+//    [self.layer addSublayer:_gradientLayer];
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    
+//    _gradientLayer.frame = self.bounds;
+}
+
+@end

+ 17 - 0
Redant Drivers/Apex And Drivers/RALoginNavigationController.h

@@ -0,0 +1,17 @@
+//
+//  RALoginNavigationController.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/10/13.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface RALoginNavigationController : UINavigationController
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 83 - 0
Redant Drivers/Apex And Drivers/RALoginNavigationController.m

@@ -0,0 +1,83 @@
+//
+//  RALoginNavigationController.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/10/13.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RALoginNavigationController.h"
+
+@interface RALoginNavigationController ()
+{
+    CAGradientLayer *_gradientLayer;
+    UIView *_barBackgroundView, *_gradientView;
+}
+@end
+
+@implementation RALoginNavigationController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    [self _configAppearance];
+}
+
+-(void) viewDidAppear:(BOOL)animated
+{
+    [super viewDidAppear:animated];
+    if(_gradientView!=nil)
+        return;
+    
+    _gradientLayer = [CAGradientLayer layer];
+    
+    UIColor *orangeWhiteColor =  ApexDriverOrangeWhiteColor;
+    UIColor *orangeColor = ApexDriverOrangeColor;
+    _gradientLayer.colors = @[(__bridge id)orangeColor.CGColor, (__bridge id)orangeWhiteColor.CGColor];
+    
+    _gradientLayer.startPoint = CGPointMake(0, 0);
+    _gradientLayer.endPoint = CGPointMake(1, 0);
+    _barBackgroundView = [self.navigationBar.subviews objectAtIndex:0];
+    
+    _gradientView = [UIView new];
+    _gradientView.frame = _barBackgroundView.bounds;
+    _gradientLayer.frame = _gradientView.bounds;
+    
+    [_gradientView.layer addSublayer:_gradientLayer];
+    [_barBackgroundView addSubview:_gradientView];
+    
+    [_barBackgroundView addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:(__bridge void * _Nullable)(self)];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
+    if (context == (__bridge void * _Nullable)(self)) {
+        
+        _gradientView.frame = _barBackgroundView.bounds;
+        _gradientLayer.frame = _gradientView.bounds;
+    }
+}
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    [_barBackgroundView removeObserver:self forKeyPath:@"frame"];
+}
+
+- (UIStatusBarStyle)preferredStatusBarStyle {
+    return UIStatusBarStyleLightContent;
+}
+
+- (void)_configAppearance {
+    
+    [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:ApexDriverWhiteColor}]; // Title Color
+    [self.navigationBar setTintColor:ApexDriverWhiteColor]; // BarItem颜色
+    self.navigationBar.barTintColor = ApexDriverOrangeColor; // 背景色
+    self.navigationBar.translucent = NO;
+    
+    // 去除Bar黑色分割线
+    self.navigationBar.shadowImage = [UIImage new];
+    [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
+    
+}
+
+@end

+ 2 - 2
Redant Drivers/Apex And Drivers/config.h

@@ -9,8 +9,8 @@
 #ifndef config_h
 #define config_h
 
-#define ApexDriverOrangeWhiteColor UIColorFromRGB(0xff8008)
-#define ApexDriverOrangeColor UIColorFromRGB(0xe65c00)
+#define ApexDriverOrangeWhiteColor UIColorFromRGB(0xe65c00)
+#define ApexDriverOrangeColor UIColorFromRGB(0xff8008)
 #define ApexDriverGrayColor UIColorFromRGB(0x4f5356)
 #define ApexDriverWhiteColor UIColorFromRGB(0xffffff)
 #define ApexDriverRedColor UIColorFromRGB(0xAE2838)