├── .DS_Store ├── NightMode ├── 夜间模式.gif ├── .DS_Store ├── 换肤_取消渲染.gif ├── NightMode │ ├── .DS_Store │ ├── NightModeTheme │ │ ├── .DS_Store │ │ ├── Resource │ │ │ ├── day@2x.png │ │ │ ├── home@2x.png │ │ │ ├── night@2x.png │ │ │ └── schema@2x.png │ │ ├── UIButton+ThemeChange.h │ │ ├── UITabBar+ThemeChange.h │ │ ├── UINavigationBar+ThemeChange.h │ │ ├── UIButton+ThemeChange.m │ │ ├── UITabBar+ThemeChange.m │ │ ├── UILabel+ThemeChange.h │ │ ├── UIView+ThemeChange.h │ │ ├── ThemeManage.h │ │ ├── UINavigationBar+ThemeChange.m │ │ ├── ThemeManage.m │ │ ├── UILabel+ThemeChange.m │ │ └── UIView+ThemeChange.m │ ├── HomeViewController.h │ ├── RootViewController.h │ ├── SchemaViewController.h │ ├── NextCollectionViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── SchemaViewController.m │ ├── Info.plist │ ├── RootViewController.m │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── NextCollectionViewController.m │ ├── AppDelegate.m │ └── HomeViewController.m ├── EA21E87F-09B2-4996-BAEB-FD2C819827B5.png ├── NightMode.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── project.pbxproj ├── NightModeTests │ ├── Info.plist │ └── NightModeTests.m └── NightModeUITests │ ├── Info.plist │ └── NightModeUITests.m ├── .gitignore └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/.DS_Store -------------------------------------------------------------------------------- /NightMode/夜间模式.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/夜间模式.gif -------------------------------------------------------------------------------- /NightMode/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/.DS_Store -------------------------------------------------------------------------------- /NightMode/换肤_取消渲染.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/换肤_取消渲染.gif -------------------------------------------------------------------------------- /NightMode/NightMode/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/NightMode/.DS_Store -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/NightMode/NightModeTheme/.DS_Store -------------------------------------------------------------------------------- /NightMode/EA21E87F-09B2-4996-BAEB-FD2C819827B5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/EA21E87F-09B2-4996-BAEB-FD2C819827B5.png -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/Resource/day@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/NightMode/NightModeTheme/Resource/day@2x.png -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/Resource/home@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/NightMode/NightModeTheme/Resource/home@2x.png -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/Resource/night@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/NightMode/NightModeTheme/Resource/night@2x.png -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/Resource/schema@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZLFighting/NightMode/HEAD/NightMode/NightMode/NightModeTheme/Resource/schema@2x.png -------------------------------------------------------------------------------- /NightMode/NightMode.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NightMode/NightMode/HomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HomeViewController.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 首页 8 | 9 | #import 10 | 11 | @interface HomeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NightMode/NightMode/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RootViewController : UITabBarController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NightMode/NightMode/SchemaViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SchemaViewController.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 菜单 8 | 9 | #import 10 | 11 | @interface SchemaViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UIButton+ThemeChange.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+ThemeChange.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/24. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIButton (ThemeChange) 12 | 13 | - (void)changeColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UITabBar+ThemeChange.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBar+ThemeChange.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/24. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UITabBar (ThemeChange) 12 | 13 | - (void)changeColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /NightMode/NightMode/NextCollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NextCollectionViewController.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NextCollectionViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UINavigationBar+ThemeChange.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+ThemeChange.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/24. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationBar (ThemeChange) 12 | 13 | - (void)changeColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /NightMode/NightMode/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /NightMode/NightMode/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UIButton+ThemeChange.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+ThemeChange.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/24. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "UIButton+ThemeChange.h" 10 | #import "ThemeManage.h" 11 | #import "UIView+ThemeChange.h" 12 | 13 | @implementation UIButton (ThemeChange) 14 | 15 | - (void)changeColor { 16 | [super changeColor]; 17 | 18 | self.titleLabel.textColor = [ThemeManage shareThemeManage].textColor; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UITabBar+ThemeChange.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBar+ThemeChange.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/24. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "UITabBar+ThemeChange.h" 10 | #import "ThemeManage.h" 11 | #import "UIView+ThemeChange.h" 12 | 13 | 14 | @implementation UITabBar (ThemeChange) 15 | 16 | - (void)changeColor { 17 | [super changeColor]; 18 | 19 | [self setBarTintColor:[ThemeManage shareThemeManage].bgColor]; 20 | [self setTintColor:[ThemeManage shareThemeManage].navBarColor]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UILabel+ThemeChange.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+ThemeChange.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 字体颜色状态枚举值 13 | */ 14 | typedef enum : NSUInteger { 15 | LabelColorBlack, // 白天黑色, 夜间白色 16 | LabelColorGray, // 白天灰色, 夜间白色 17 | } LabelColor; 18 | 19 | @interface UILabel (ThemeChange) 20 | 21 | @property(nonatomic, assign) id textType; 22 | 23 | - (void)changeColor; 24 | 25 | // 设置字体的颜色 26 | - (void)NightTextType:(LabelColor)type; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /NightMode/NightModeTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NightMode/NightModeUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NightMode/NightMode/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UIView+ThemeChange.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ThemeChange.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 颜色状态枚举值 颜色的定义(一个代表一套) 13 | */ 14 | typedef NS_ENUM(NSInteger, UIViewColorType) { 15 | 16 | UIViewColorTypeNormal, // 白天白色, 夜间黑色 17 | UIViewColorType1, // 白天蓝色, 夜间深灰 18 | UIViewColorType2, // 白天浅蓝, 夜间浅蓝 19 | UIViewColorTypeClear // 透明状态 20 | }; 21 | 22 | @interface UIView (ThemeChange) 23 | 24 | // 定义颜色类型的属性, NSNumber类型 25 | @property(nonatomic, assign) id type; 26 | 27 | // 消息中心开始监听 28 | - (void)startMonitor; 29 | // 改变颜色的方法 30 | - (void)changeColor; 31 | // 设置颜色类型和对应颜色 32 | - (void)NightWithType:(UIViewColorType)type; 33 | 34 | // 设置字体颜色的方法 35 | - (void)initTextColor; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/ThemeManage.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThemeManage.h 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ThemeManage : NSObject 13 | 14 | #pragma mark - 颜色属性 15 | @property(nonatomic, retain) UIColor *bgColor; 16 | @property(nonatomic, retain) UIColor *color1; 17 | @property(nonatomic, retain) UIColor *color2; 18 | @property(nonatomic, retain) UIColor *textColor; 19 | @property(nonatomic, retain) UIColor *textColorGray; 20 | @property(nonatomic, retain) UIColor *navBarColor; 21 | @property(nonatomic, retain) UIColor *colorClear; 22 | 23 | #pragma mark - 24 | 25 | // 是否是夜间 YES表示夜间, NO为正常 26 | @property(nonatomic, assign) BOOL isNight; 27 | 28 | /** 29 | * 模式管理单例 30 | */ 31 | + (ThemeManage *)shareThemeManage; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UINavigationBar+ThemeChange.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+ThemeChange.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/24. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "UINavigationBar+ThemeChange.h" 10 | #import "ThemeManage.h" 11 | #import "UIView+ThemeChange.h" 12 | 13 | @implementation UINavigationBar (ThemeChange) 14 | 15 | 16 | - (void)changeColor { 17 | 18 | [super changeColor]; 19 | 20 | [self setBarTintColor:[ThemeManage shareThemeManage].bgColor]; 21 | [self setBackgroundColor:[UIColor clearColor]]; 22 | [self setTitleTextAttributes:@{NSForegroundColorAttributeName: [ThemeManage shareThemeManage].navBarColor}]; 23 | 24 | // 改变电池栏Style 25 | if ([ThemeManage shareThemeManage].isNight) { 26 | [self setBarStyle:UIBarStyleBlackTranslucent]; 27 | } else{ 28 | [self setBarStyle:UIBarStyleDefault]; 29 | } 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /NightMode/NightModeTests/NightModeTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NightModeTests.m 3 | // NightModeTests 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NightModeTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NightModeTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /NightMode/NightMode/SchemaViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SchemaViewController.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "SchemaViewController.h" 10 | #import "UIView+ThemeChange.h" 11 | #import "UILabel+ThemeChange.h" 12 | 13 | @interface SchemaViewController () 14 | 15 | @end 16 | 17 | @implementation SchemaViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.title = @"主题"; 23 | [self.view NightWithType:UIViewColorType1]; 24 | 25 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(125, 125, 125, 40)]; 26 | [label NightTextType:LabelColorGray]; 27 | [label NightWithType:UIViewColorTypeClear]; 28 | label.text = @"第二个tabBar"; 29 | [self.view addSubview:label]; 30 | 31 | } 32 | 33 | - (void)dealloc { 34 | // 移除监听 35 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 36 | } 37 | 38 | - (void)didReceiveMemoryWarning { 39 | [super didReceiveMemoryWarning]; 40 | // Dispose of any resources that can be recreated. 41 | } 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /NightMode/NightMode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | 夜间模式 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /NightMode/NightModeUITests/NightModeUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NightModeUITests.m 3 | // NightModeUITests 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NightModeUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NightModeUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /NightMode/NightMode/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | #import "ThemeManage.h" 11 | #import "UIView+ThemeChange.h" 12 | #import "HomeViewController.h" 13 | #import "SchemaViewController.h" 14 | 15 | @interface RootViewController () 16 | 17 | @end 18 | 19 | @implementation RootViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | [self.view NightWithType:UIViewColorTypeNormal]; 25 | 26 | HomeViewController *vc = [[HomeViewController alloc] init]; 27 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; 28 | // 设置navigationBar的夜间模式状态 29 | [nav.navigationBar NightWithType:UIViewColorTypeNormal]; 30 | vc.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed:@"home"] tag:10]; 31 | 32 | SchemaViewController *secondVC = [[SchemaViewController alloc] init]; 33 | UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:secondVC]; 34 | // 设置navigationBar的夜间模式状态 35 | [nav1.navigationBar NightWithType:UIViewColorTypeNormal]; 36 | secondVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"菜单" image:[UIImage imageNamed:@"schema"] tag:11]; 37 | 38 | [self.tabBar NightWithType:UIViewColorTypeNormal]; 39 | self.viewControllers = @[nav, nav1]; 40 | self.tabBar.translucent = NO; 41 | [[UINavigationBar appearance] setTranslucent:NO]; 42 | } 43 | 44 | - (void)didReceiveMemoryWarning { 45 | [super didReceiveMemoryWarning]; 46 | // Dispose of any resources that can be recreated. 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/ThemeManage.m: -------------------------------------------------------------------------------- 1 | // 2 | // ThemeManage.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "ThemeManage.h" 10 | 11 | static ThemeManage *themeManage; // 单例 12 | 13 | 14 | @implementation ThemeManage 15 | 16 | #pragma mark - 单例的初始化 17 | 18 | + (ThemeManage *)shareThemeManage { 19 | 20 | static dispatch_once_t onceToken; 21 | dispatch_once(&onceToken, ^{ 22 | themeManage = [[ThemeManage alloc] init]; 23 | }); 24 | return themeManage; 25 | } 26 | 27 | #pragma mark 重写isNight的set方法 28 | 29 | - (void)setIsNight:(BOOL)isNight { 30 | 31 | _isNight = isNight; 32 | 33 | if (self.isNight) { // 夜间模式改变相关颜色 34 | 35 | self.bgColor = [UIColor colorWithRed:0.06 green:0.08 blue:0.1 alpha:1]; 36 | self.textColor = [UIColor whiteColor]; 37 | self.color1 = [UIColor colorWithRed:0.08 green:0.11 blue:0.13 alpha:1]; 38 | self.navBarColor = [UIColor whiteColor]; 39 | self.color2 = [UIColor colorWithRed:0.2 green:0.31 blue:0.43 alpha:1]; 40 | self.textColorGray = [UIColor whiteColor]; 41 | } else{ 42 | 43 | self.bgColor = [UIColor whiteColor]; 44 | self.textColor = [UIColor blackColor]; 45 | self.color1 = [UIColor colorWithRed:0.06 green:0.25 blue:0.48 alpha:1]; 46 | self.navBarColor = [UIColor colorWithRed:0.31 green:0.73 blue:0.58 alpha:1]; 47 | self.color2 = [UIColor colorWithRed:0.57 green:0.66 blue:0.77 alpha:1]; 48 | self.textColorGray = [UIColor grayColor]; 49 | } 50 | 51 | static dispatch_once_t onceToken; 52 | dispatch_once(&onceToken, ^{ 53 | self.colorClear = [UIColor clearColor]; 54 | }); 55 | } 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UILabel+ThemeChange.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+ThemeChange.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "UILabel+ThemeChange.h" 10 | // 添加runtime头文件 11 | #import 12 | #import "ThemeManage.h" 13 | #import "UIView+ThemeChange.h" 14 | 15 | @implementation UILabel (ThemeChange) 16 | 17 | 18 | #pragma mark - 添加字体颜色枚举的属性 19 | 20 | - (void)setTextType:(id)textType { 21 | objc_setAssociatedObject(self, @selector(textType), textType, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 22 | } 23 | 24 | - (id)textType { 25 | return objc_getAssociatedObject(self, @selector(textType)); 26 | } 27 | 28 | #pragma mark - 重写changeColor方法 29 | 30 | - (void)changeColor { 31 | 32 | [super changeColor]; 33 | 34 | switch ([self.textType integerValue]) { 35 | case LabelColorBlack: 36 | self.textColor = [ThemeManage shareThemeManage].textColor; 37 | break; 38 | case LabelColorGray: 39 | self.textColor = [ThemeManage shareThemeManage].textColorGray; 40 | break; 41 | 42 | default: 43 | break; 44 | } 45 | } 46 | 47 | - (void)NightTextType:(LabelColor)type { 48 | self.textType = [NSNumber numberWithInteger:type]; 49 | [self changeColor]; 50 | } 51 | 52 | 53 | #pragma mark - 初始化字体的颜色 54 | 55 | - (void)initTextColor { 56 | switch ([self.textType integerValue]) { 57 | case LabelColorBlack: 58 | self.textColor = [ThemeManage shareThemeManage].textColor; 59 | break; 60 | case LabelColorGray: 61 | self.textColor = [ThemeManage shareThemeManage].textColorGray; 62 | break; 63 | 64 | default: 65 | break; 66 | } 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /NightMode/NightMode/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /NightMode/NightMode/NightModeTheme/UIView+ThemeChange.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ThemeChange.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "UIView+ThemeChange.h" 10 | #import "ThemeManage.h" 11 | // 添加runtime头文件 12 | #import 13 | 14 | @implementation UIView (ThemeChange) 15 | 16 | #pragma mark - 添加type的set,get方法 17 | 18 | - (void)setType:(id)type { 19 | 20 | objc_setAssociatedObject(self, @selector(type), type, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 21 | } 22 | 23 | - (id)type { 24 | return objc_getAssociatedObject(self, @selector(type)); 25 | } 26 | 27 | #pragma mark - 开始监听 28 | 29 | - (void)startMonitor { 30 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor) name:@"changeColor" object:nil]; 31 | } 32 | 33 | #pragma mark - 改变颜色 34 | 35 | - (void)changeColor { 36 | // type为NSNumber型, 变为NSInteger 37 | switch ([self.type integerValue]) { 38 | case UIViewColorTypeNormal: 39 | self.backgroundColor = [ThemeManage shareThemeManage].bgColor; 40 | break; 41 | case UIViewColorType1: 42 | self.backgroundColor = [ThemeManage shareThemeManage].color1; 43 | break; 44 | case UIViewColorType2: 45 | self.backgroundColor = [ThemeManage shareThemeManage].color2; 46 | break; 47 | case UIViewColorTypeClear: 48 | self.backgroundColor = [ThemeManage shareThemeManage].colorClear; 49 | break; 50 | 51 | default: 52 | break; 53 | } 54 | 55 | } 56 | 57 | #pragma mark - 设置颜色类型和对应颜色 58 | 59 | - (void)NightWithType:(UIViewColorType)type { 60 | 61 | self.type = [NSNumber numberWithInteger:type]; 62 | [self changeColor]; 63 | [self startMonitor]; 64 | 65 | // 调用设置字体颜色的方法 66 | [self initTextColor]; 67 | } 68 | 69 | #pragma mark - 改变字体颜色的方法, 空方法, 可以在子类中重写这个方法来改变颜色(例如:Label) 70 | 71 | - (void)initTextColor { 72 | 73 | } 74 | 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /NightMode/NightMode/NextCollectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NextCollectionViewController.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "NextCollectionViewController.h" 10 | #import "UIView+ThemeChange.h" 11 | 12 | @interface NextCollectionViewController () 13 | 14 | @end 15 | 16 | @implementation NextCollectionViewController 17 | 18 | static NSString * const reuseIdentifier = @"Cell"; 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.title = @"详情"; 24 | [self.view NightWithType:UIViewColorTypeNormal]; 25 | 26 | [self.collectionView NightWithType:UIViewColorTypeNormal]; 27 | 28 | // Register cell classes 29 | [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier]; 30 | 31 | // Do any additional setup after loading the view. 32 | } 33 | 34 | - (void)didReceiveMemoryWarning { 35 | [super didReceiveMemoryWarning]; 36 | // Dispose of any resources that can be recreated. 37 | } 38 | 39 | #pragma mark 40 | 41 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { 42 | return 1; 43 | } 44 | 45 | 46 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 47 | return 50; 48 | } 49 | 50 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 51 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; 52 | 53 | [cell NightWithType:UIViewColorType1]; 54 | 55 | return cell; 56 | } 57 | 58 | #pragma mark 59 | 60 | /* 61 | // Uncomment this method to specify if the specified item should be highlighted during tracking 62 | - (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath { 63 | return YES; 64 | } 65 | */ 66 | 67 | /* 68 | // Uncomment this method to specify if the specified item should be selected 69 | - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath { 70 | return YES; 71 | } 72 | */ 73 | 74 | /* 75 | // Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item 76 | - (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath { 77 | return NO; 78 | } 79 | 80 | - (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { 81 | return NO; 82 | } 83 | 84 | - (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { 85 | 86 | } 87 | */ 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /NightMode/NightMode/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "RootViewController.h" 11 | #import "ThemeManage.h" 12 | #import "UIView+ThemeChange.h" 13 | 14 | @interface AppDelegate () 15 | 16 | @end 17 | 18 | @implementation AppDelegate 19 | 20 | 21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 22 | 23 | // 获取夜间模式状态 24 | [ThemeManage shareThemeManage].isNight = [[NSUserDefaults standardUserDefaults] boolForKey:@"night"]; 25 | 26 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 27 | self.window.backgroundColor = [UIColor whiteColor]; 28 | [self.window makeKeyAndVisible]; 29 | 30 | RootViewController *rootVc = [[RootViewController alloc] init]; 31 | // 设置tabBar的夜间模式状态 32 | [rootVc.tabBar NightWithType:UIViewColorTypeNormal]; 33 | // UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootVc]; 34 | // // 设置navigationBar的夜间模式状态 35 | // [nav.navigationBar NightWithType:UIViewColorTypeNormal]; 36 | 37 | 38 | self.window.rootViewController = rootVc; 39 | 40 | return YES; 41 | } 42 | 43 | 44 | - (void)applicationWillResignActive:(UIApplication *)application { 45 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 46 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 47 | } 48 | 49 | 50 | - (void)applicationDidEnterBackground:(UIApplication *)application { 51 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 52 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 53 | } 54 | 55 | 56 | - (void)applicationWillEnterForeground:(UIApplication *)application { 57 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 58 | } 59 | 60 | 61 | - (void)applicationDidBecomeActive:(UIApplication *)application { 62 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 63 | } 64 | 65 | 66 | - (void)applicationWillTerminate:(UIApplication *)application { 67 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 68 | } 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /NightMode/NightMode/HomeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HomeViewController.m 3 | // NightMode 4 | // 5 | // Created by ZL on 2017/4/21. 6 | // Copyright © 2017年 ZL. All rights reserved. 7 | // 8 | 9 | #import "HomeViewController.h" 10 | #import "ThemeManage.h" 11 | #import "UIView+ThemeChange.h" 12 | #import "UILabel+ThemeChange.h" 13 | #import "NextCollectionViewController.h" 14 | 15 | @interface HomeViewController () 16 | 17 | @end 18 | 19 | @implementation HomeViewController 20 | 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | self.title = @"首页"; 26 | 27 | [self.view NightWithType:UIViewColorTypeNormal]; 28 | 29 | UIImage *barButtonImage = [ThemeManage shareThemeManage].isNight ? [UIImage imageNamed:@"night"] : [UIImage imageNamed:@"day"]; 30 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:barButtonImage style:UIBarButtonItemStylePlain target:self action:@selector(rightBarBtnAction:)]; 31 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"present" style:UIBarButtonItemStylePlain target:self action:@selector(presentClick)]; 32 | 33 | 34 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 200, 40)]; 35 | label.text = @"测试看看字色及背景色"; 36 | [label NightWithType:UIViewColorTypeNormal]; 37 | [label NightTextType:LabelColorGray]; 38 | [self.view addSubview:label]; 39 | 40 | UIButton *pushBtn = [UIButton buttonWithType:UIButtonTypeSystem]; 41 | pushBtn.frame = CGRectMake(100, 200, 100, 40); 42 | self.view.center = pushBtn.center; 43 | pushBtn.backgroundColor = [UIColor orangeColor]; 44 | pushBtn.layer.cornerRadius = 10; 45 | [pushBtn addTarget:self action:@selector(pushBtnClick) forControlEvents:UIControlEventTouchUpInside]; 46 | [pushBtn setTitle:@"push详情" forState:UIControlStateNormal]; 47 | [self.view addSubview:pushBtn]; 48 | } 49 | 50 | #pragma mark - Action点击动作事件 51 | 52 | // 切换夜间模式 53 | - (void)rightBarBtnAction:(UIBarButtonItem *)barButton { 54 | 55 | [ThemeManage shareThemeManage].isNight = ![ThemeManage shareThemeManage].isNight; 56 | [[NSNotificationCenter defaultCenter] postNotificationName:@"changeColor" object:nil]; 57 | [[NSUserDefaults standardUserDefaults] setBool:[ThemeManage shareThemeManage].isNight forKey:@"night"]; 58 | UIImage *barBtnImage = [ThemeManage shareThemeManage].isNight ? [UIImage imageNamed:@"night"] : [UIImage imageNamed:@"day"]; 59 | [barButton setImage:barBtnImage]; 60 | } 61 | 62 | - (void)pushBtnClick { 63 | UICollectionViewFlowLayout *flow = [[UICollectionViewFlowLayout alloc] init]; 64 | flow.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); 65 | flow.itemSize = CGSizeMake(100, 100); 66 | 67 | NextCollectionViewController *vc = [[NextCollectionViewController alloc] initWithCollectionViewLayout:flow]; 68 | [self.navigationController pushViewController:vc animated:YES]; 69 | } 70 | 71 | - (void)presentClick { 72 | 73 | UICollectionViewFlowLayout *flow = [[UICollectionViewFlowLayout alloc] init]; 74 | flow.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); 75 | flow.itemSize = CGSizeMake(100, 100); 76 | 77 | NextCollectionViewController *vc = [[NextCollectionViewController alloc] initWithCollectionViewLayout:flow]; 78 | [self presentViewController:vc animated:YES completion:nil]; 79 | } 80 | 81 | - (void)dealloc { 82 | // 移除监听 83 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 84 | } 85 | 86 | - (void)didReceiveMemoryWarning { 87 | [super didReceiveMemoryWarning]; 88 | // Dispose of any resources that can be recreated. 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NightMode 2 | 夜间模式(换肤设置) 3 | 4 | iOS 开发中有时候会有夜间模式(换肤设置)的需求, 其实主要是更改相关颜色操作! 5 | 6 | ![](https://github.com/ZLFighting/NightMode/blob/master/NightMode/EA21E87F-09B2-4996-BAEB-FD2C819827B5.png) 7 | 8 | **思路:** 每次切换夜间/白天模式时,都会发出通知给所有ViewController,让它们切换到相应的主题。 9 | >1. 创建一个管理模式主题的单例管理类ThemeManage 10 | 2. 封装好需要做夜间模式变色处理的控件扩展:UIView (ThemeChange), UINavigationBar (ThemeChange), UITabBar (ThemeChange), UILabel (ThemeChange), UIButton (ThemeChange) 11 | 3. 在 AppDelegate里先获取夜间模式状态, 根控制器里先设置tabBar 及 子控制器里navigationBar的夜间模式状态 12 | 4. 添加控制白天/黑夜模式item,发通知切换相对应i模式及image 13 | 5. 添加相关控件是否黑夜模式下已更换字色和背景色 14 | 15 | 16 | ## 一. 创建一个管理模式主题的单例管理类ThemeManage 17 | 18 | ThemeManage.h 文件: 19 | ``` 20 | #import 21 | #import 22 | 23 | @interface ThemeManage : NSObject 24 | 25 | #pragma mark - 颜色属性 26 | @property(nonatomic, retain) UIColor *bgColor; 27 | @property(nonatomic, retain) UIColor *color1; 28 | @property(nonatomic, retain) UIColor *color2; 29 | @property(nonatomic, retain) UIColor *textColor; 30 | @property(nonatomic, retain) UIColor *textColorGray; 31 | @property(nonatomic, retain) UIColor *navBarColor; 32 | @property(nonatomic, retain) UIColor *colorClear; 33 | 34 | #pragma mark - 35 | 36 | // 是否是夜间 YES表示夜间, NO为正常 37 | @property(nonatomic, assign) BOOL isNight; 38 | 39 | /** 40 | * 模式管理单例 41 | */ 42 | + (ThemeManage *)shareThemeManage; 43 | 44 | @end 45 | ``` 46 | ThemeManage. m 文件 47 | ``` 48 | #import "ThemeManage.h" 49 | 50 | static ThemeManage *themeManage; // 单例 51 | 52 | 53 | @implementation ThemeManage 54 | 55 | #pragma mark - 单例的初始化 56 | 57 | + (ThemeManage *)shareThemeManage { 58 | 59 | static dispatch_once_t onceToken; 60 | dispatch_once(&onceToken, ^{ 61 | themeManage = [[ThemeManage alloc] init]; 62 | }); 63 | return themeManage; 64 | } 65 | 66 | #pragma mark 重写isNight的set方法 67 | 68 | - (void)setIsNight:(BOOL)isNight { 69 | 70 | _isNight = isNight; 71 | 72 | if (self.isNight) { // 夜间模式改变相关颜色 73 | 74 | self.bgColor = [UIColor colorWithRed:0.06 green:0.08 blue:0.1 alpha:1]; 75 | self.textColor = [UIColor whiteColor]; 76 | self.color1 = [UIColor colorWithRed:0.08 green:0.11 blue:0.13 alpha:1]; 77 | self.navBarColor = [UIColor whiteColor]; 78 | self.color2 = [UIColor colorWithRed:0.2 green:0.31 blue:0.43 alpha:1]; 79 | self.textColorGray = [UIColor whiteColor]; 80 | } else{ 81 | 82 | self.bgColor = [UIColor whiteColor]; 83 | self.textColor = [UIColor blackColor]; 84 | self.color1 = [UIColor colorWithRed:0.06 green:0.25 blue:0.48 alpha:1]; 85 | self.navBarColor = [UIColor colorWithRed:0.31 green:0.73 blue:0.58 alpha:1]; 86 | self.color2 = [UIColor colorWithRed:0.57 green:0.66 blue:0.77 alpha:1]; 87 | self.textColorGray = [UIColor grayColor]; 88 | } 89 | 90 | static dispatch_once_t onceToken; 91 | dispatch_once(&onceToken, ^{ 92 | self.colorClear = [UIColor clearColor]; 93 | }); 94 | } 95 | 96 | @end 97 | ``` 98 | 99 | ## 二. 封装好需要做夜间模式变色处理的控件扩展 100 | 一般需要UIView (ThemeChange), UINavigationBar (ThemeChange), UITabBar (ThemeChange), UILabel (ThemeChange), UIButton (ThemeChange);这里拿 UIView 做例子: 101 | ``` 102 | #import 103 | 104 | /** 105 | * 颜色状态枚举值 颜色的定义(一个代表一套) 106 | */ 107 | typedef NS_ENUM(NSInteger, UIViewColorType) { 108 | 109 | UIViewColorTypeNormal, // 白天白色, 夜间黑色 110 | UIViewColorType1, // 白天蓝色, 夜间深灰 111 | UIViewColorType2, // 白天浅蓝, 夜间浅蓝 112 | UIViewColorTypeClear // 透明状态 113 | }; 114 | 115 | @interface UIView (ThemeChange) 116 | 117 | // 定义颜色类型的属性, NSNumber类型 118 | @property(nonatomic, assign) id type; 119 | 120 | // 消息中心开始监听 121 | - (void)startMonitor; 122 | // 改变颜色的方法 123 | - (void)changeColor; 124 | // 设置颜色类型和对应颜色 125 | - (void)NightWithType:(UIViewColorType)type; 126 | 127 | // 设置字体颜色的方法 128 | - (void)initTextColor; 129 | 130 | @end 131 | ``` 132 | ``` 133 | #import "UIView+ThemeChange.h" 134 | #import "ThemeManage.h" 135 | // 添加runtime头文件 136 | #import 137 | 138 | @implementation UIView (ThemeChange) 139 | 140 | #pragma mark - 添加type的set,get方法 141 | 142 | - (void)setType:(id)type { 143 | 144 | objc_setAssociatedObject(self, @selector(type), type, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 145 | } 146 | 147 | - (id)type { 148 | return objc_getAssociatedObject(self, @selector(type)); 149 | } 150 | 151 | #pragma mark - 开始监听 152 | 153 | - (void)startMonitor { 154 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor) name:@"changeColor" object:nil]; 155 | } 156 | 157 | #pragma mark - 改变颜色 158 | 159 | - (void)changeColor { 160 | // type为NSNumber型, 变为NSInteger 161 | switch ([self.type integerValue]) { 162 | case UIViewColorTypeNormal: 163 | self.backgroundColor = [ThemeManage shareThemeManage].bgColor; 164 | break; 165 | case UIViewColorType1: 166 | self.backgroundColor = [ThemeManage shareThemeManage].color1; 167 | break; 168 | case UIViewColorType2: 169 | self.backgroundColor = [ThemeManage shareThemeManage].color2; 170 | break; 171 | case UIViewColorTypeClear: 172 | self.backgroundColor = [ThemeManage shareThemeManage].colorClear; 173 | break; 174 | 175 | default: 176 | break; 177 | } 178 | 179 | } 180 | 181 | #pragma mark - 设置颜色类型和对应颜色 182 | 183 | - (void)NightWithType:(UIViewColorType)type { 184 | 185 | self.type = [NSNumber numberWithInteger:type]; 186 | [self changeColor]; 187 | [self startMonitor]; 188 | 189 | // 调用设置字体颜色的方法 190 | [self initTextColor]; 191 | } 192 | 193 | #pragma mark - 改变字体颜色的方法, 空方法, 可以在子类中重写这个方法来改变颜色(例如:Label) 194 | 195 | - (void)initTextColor { 196 | 197 | } 198 | 199 | @end 200 | ``` 201 | 202 | ## 三. 在 AppDelegate里先获取夜间模式状态, 根控制器里先设置tabBar 及 子控制器里navigationBar的夜间模式状态 203 | ``` 204 | #import "ThemeManage.h" 205 | #import "UIView+ThemeChange.h" 206 | ``` 207 | ``` 208 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 209 | 210 | // 获取夜间模式状态 211 | [ThemeManage shareThemeManage].isNight = [[NSUserDefaults standardUserDefaults] boolForKey:@"night"]; 212 | 213 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 214 | self.window.backgroundColor = [UIColor whiteColor]; 215 | [self.window makeKeyAndVisible]; 216 | 217 | RootViewController *rootVc = [[RootViewController alloc] init]; 218 | self.window.rootViewController = rootVc; 219 | 220 | return YES; 221 | } 222 | ``` 223 | RootViewController.m 文件: 224 | ``` 225 | - (void)viewDidLoad { 226 | [super viewDidLoad]; 227 | 228 | [self.view NightWithType:UIViewColorTypeNormal]; 229 | 230 | HomeViewController *vc = [[HomeViewController alloc] init]; 231 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; 232 | // 设置navigationBar的夜间模式状态 233 | [nav.navigationBar NightWithType:UIViewColorTypeNormal]; 234 | vc.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed:@"home"] tag:10]; 235 | 236 | SchemaViewController *secondVC = [[SchemaViewController alloc] init]; 237 | UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:secondVC]; 238 | // 设置navigationBar的夜间模式状态 239 | [nav1.navigationBar NightWithType:UIViewColorTypeNormal]; 240 | secondVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"菜单" image:[UIImage imageNamed:@"schema"] tag:11]; 241 | 242 | [self.tabBar NightWithType:UIViewColorTypeNormal]; 243 | self.viewControllers = @[nav, nav1]; 244 | self.tabBar.translucent = NO; 245 | [[UINavigationBar appearance] setTranslucent:NO]; 246 | } 247 | ``` 248 | 249 | ## 四. 添加控制白天/黑夜模式item,发通知切换相对应i模式及image. 250 | ``` 251 | #import "ThemeManage.h" 252 | #import "UIView+ThemeChange.h" 253 | ``` 254 | ``` 255 | [self.view NightWithType:UIViewColorTypeNormal]; 256 | 257 | UIImage *barButtonImage = [ThemeManage shareThemeManage].isNight ? [UIImage imageNamed:@"night"] : [UIImage imageNamed:@"day"]; 258 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:barButtonImage style:UIBarButtonItemStylePlain target:self action:@selector(rightBarBtnAction:)]; 259 | ``` 260 | 261 | ``` 262 | #pragma mark - Action点击动作事件 263 | 264 | // 切换夜间模式 265 | - (void)rightBarBtnAction:(UIBarButtonItem *)barButton { 266 | 267 | [ThemeManage shareThemeManage].isNight = ![ThemeManage shareThemeManage].isNight; 268 | [[NSNotificationCenter defaultCenter] postNotificationName:@"changeColor" object:nil]; 269 | [[NSUserDefaults standardUserDefaults] setBool:[ThemeManage shareThemeManage].isNight forKey:@"night"]; 270 | UIImage *barBtnImage = [ThemeManage shareThemeManage].isNight ? [UIImage imageNamed:@"night"] : [UIImage imageNamed:@"day"]; 271 | [barButton setImage:barBtnImage]; 272 | } 273 | ``` 274 | 发了通知不要忘记移除监听 275 | ``` 276 | - (void)dealloc { 277 | // 移除监听 278 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 279 | } 280 | ``` 281 | 282 | ## 五. 添加相关控件是否黑夜模式下已更换字色和背景色 283 | ``` 284 | #import "UILabel+ThemeChange.h" 285 | ``` 286 | ``` 287 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 200, 40)]; 288 | label.text = @"测试看看字色及背景色"; 289 | [label NightWithType:UIViewColorTypeNormal]; 290 | [label NightTextType:LabelColorGray]; 291 | [self.view addSubview:label]; 292 | ``` 293 | 294 | 这时候测试下, 看下效果: 295 | 296 | ![夜间模式.gif](https://github.com/ZLFighting/NightMode/blob/master/NightMode/夜间模式.gif) 297 | 298 | 299 | **PS:当不是同一图标切换图标的渲染取消效果** 300 | ``` 301 | // 申明:这张选中图片按照原始的样子显示出来,取消渲染(而默认选中后渲染的render蓝色) 302 | UIImage *barBtnImage = [ThemeManage shareThemeManage].isNight ? [[UIImage imageNamed:@"night"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] : [[UIImage imageNamed:@"day"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 303 | [barButton setImage:barBtnImage]; 304 | ``` 305 | ![换肤_取消渲染.gif](https://github.com/ZLFighting/NightMode/blob/master/NightMode/换肤_取消渲染.gif) 306 | 307 | 308 | 您的支持是作为程序媛的我最大的动力, 如果觉得对你有帮助请送个Star吧,谢谢啦 309 | -------------------------------------------------------------------------------- /NightMode/NightMode.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 78A9F3301EA9A12500197C26 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F32F1EA9A12500197C26 /* main.m */; }; 11 | 78A9F3331EA9A12500197C26 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3321EA9A12500197C26 /* AppDelegate.m */; }; 12 | 78A9F33B1EA9A12500197C26 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 78A9F33A1EA9A12500197C26 /* Assets.xcassets */; }; 13 | 78A9F33E1EA9A12500197C26 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 78A9F33C1EA9A12500197C26 /* LaunchScreen.storyboard */; }; 14 | 78A9F3491EA9A12500197C26 /* NightModeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3481EA9A12500197C26 /* NightModeTests.m */; }; 15 | 78A9F3541EA9A12500197C26 /* NightModeUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3531EA9A12500197C26 /* NightModeUITests.m */; }; 16 | 78A9F3631EA9A1E700197C26 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3621EA9A1E700197C26 /* RootViewController.m */; }; 17 | 78A9F36A1EA9D97100197C26 /* schema@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 78A9F3661EA9D97100197C26 /* schema@2x.png */; }; 18 | 78A9F36B1EA9D97100197C26 /* day@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 78A9F3671EA9D97100197C26 /* day@2x.png */; }; 19 | 78A9F36C1EA9D97100197C26 /* home@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 78A9F3681EA9D97100197C26 /* home@2x.png */; }; 20 | 78A9F36D1EA9D97100197C26 /* night@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 78A9F3691EA9D97100197C26 /* night@2x.png */; }; 21 | 78A9F3701EA9E45900197C26 /* ThemeManage.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F36F1EA9E45900197C26 /* ThemeManage.m */; }; 22 | 78A9F3731EA9E73200197C26 /* UIView+ThemeChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3721EA9E73200197C26 /* UIView+ThemeChange.m */; }; 23 | 78A9F3761EA9FBB900197C26 /* NextCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3751EA9FBB900197C26 /* NextCollectionViewController.m */; }; 24 | 78A9F3791EAA02F300197C26 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3781EAA02F300197C26 /* HomeViewController.m */; }; 25 | 78A9F37C1EAA033D00197C26 /* SchemaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F37B1EAA033D00197C26 /* SchemaViewController.m */; }; 26 | 78A9F37F1EAA054800197C26 /* UILabel+ThemeChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F37E1EAA054800197C26 /* UILabel+ThemeChange.m */; }; 27 | 78A9F3821EAD9FF400197C26 /* UINavigationBar+ThemeChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3811EAD9FF400197C26 /* UINavigationBar+ThemeChange.m */; }; 28 | 78A9F3851EADA20700197C26 /* UITabBar+ThemeChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3841EADA20700197C26 /* UITabBar+ThemeChange.m */; }; 29 | 78A9F3881EADA28900197C26 /* UIButton+ThemeChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 78A9F3871EADA28900197C26 /* UIButton+ThemeChange.m */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | 78A9F3451EA9A12500197C26 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 78A9F3231EA9A12500197C26 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 78A9F32A1EA9A12500197C26; 38 | remoteInfo = NightMode; 39 | }; 40 | 78A9F3501EA9A12500197C26 /* PBXContainerItemProxy */ = { 41 | isa = PBXContainerItemProxy; 42 | containerPortal = 78A9F3231EA9A12500197C26 /* Project object */; 43 | proxyType = 1; 44 | remoteGlobalIDString = 78A9F32A1EA9A12500197C26; 45 | remoteInfo = NightMode; 46 | }; 47 | /* End PBXContainerItemProxy section */ 48 | 49 | /* Begin PBXFileReference section */ 50 | 78A9F32B1EA9A12500197C26 /* NightMode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NightMode.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 78A9F32F1EA9A12500197C26 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 78A9F3311EA9A12500197C26 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 53 | 78A9F3321EA9A12500197C26 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 54 | 78A9F33A1EA9A12500197C26 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | 78A9F33D1EA9A12500197C26 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 56 | 78A9F33F1EA9A12500197C26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 78A9F3441EA9A12500197C26 /* NightModeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NightModeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 78A9F3481EA9A12500197C26 /* NightModeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NightModeTests.m; sourceTree = ""; }; 59 | 78A9F34A1EA9A12500197C26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 78A9F34F1EA9A12500197C26 /* NightModeUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NightModeUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 78A9F3531EA9A12500197C26 /* NightModeUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NightModeUITests.m; sourceTree = ""; }; 62 | 78A9F3551EA9A12500197C26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | 78A9F3611EA9A1E700197C26 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 64 | 78A9F3621EA9A1E700197C26 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 65 | 78A9F3661EA9D97100197C26 /* schema@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "schema@2x.png"; sourceTree = ""; }; 66 | 78A9F3671EA9D97100197C26 /* day@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "day@2x.png"; sourceTree = ""; }; 67 | 78A9F3681EA9D97100197C26 /* home@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "home@2x.png"; sourceTree = ""; }; 68 | 78A9F3691EA9D97100197C26 /* night@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "night@2x.png"; sourceTree = ""; }; 69 | 78A9F36E1EA9E45900197C26 /* ThemeManage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeManage.h; sourceTree = ""; }; 70 | 78A9F36F1EA9E45900197C26 /* ThemeManage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThemeManage.m; sourceTree = ""; }; 71 | 78A9F3711EA9E73200197C26 /* UIView+ThemeChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+ThemeChange.h"; sourceTree = ""; }; 72 | 78A9F3721EA9E73200197C26 /* UIView+ThemeChange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+ThemeChange.m"; sourceTree = ""; }; 73 | 78A9F3741EA9FBB900197C26 /* NextCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NextCollectionViewController.h; sourceTree = ""; }; 74 | 78A9F3751EA9FBB900197C26 /* NextCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NextCollectionViewController.m; sourceTree = ""; }; 75 | 78A9F3771EAA02F300197C26 /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = ""; }; 76 | 78A9F3781EAA02F300197C26 /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = ""; }; 77 | 78A9F37A1EAA033D00197C26 /* SchemaViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SchemaViewController.h; sourceTree = ""; }; 78 | 78A9F37B1EAA033D00197C26 /* SchemaViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SchemaViewController.m; sourceTree = ""; }; 79 | 78A9F37D1EAA054800197C26 /* UILabel+ThemeChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+ThemeChange.h"; sourceTree = ""; }; 80 | 78A9F37E1EAA054800197C26 /* UILabel+ThemeChange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+ThemeChange.m"; sourceTree = ""; }; 81 | 78A9F3801EAD9FF400197C26 /* UINavigationBar+ThemeChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+ThemeChange.h"; sourceTree = ""; }; 82 | 78A9F3811EAD9FF400197C26 /* UINavigationBar+ThemeChange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+ThemeChange.m"; sourceTree = ""; }; 83 | 78A9F3831EADA20700197C26 /* UITabBar+ThemeChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITabBar+ThemeChange.h"; sourceTree = ""; }; 84 | 78A9F3841EADA20700197C26 /* UITabBar+ThemeChange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITabBar+ThemeChange.m"; sourceTree = ""; }; 85 | 78A9F3861EADA28900197C26 /* UIButton+ThemeChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+ThemeChange.h"; sourceTree = ""; }; 86 | 78A9F3871EADA28900197C26 /* UIButton+ThemeChange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+ThemeChange.m"; sourceTree = ""; }; 87 | /* End PBXFileReference section */ 88 | 89 | /* Begin PBXFrameworksBuildPhase section */ 90 | 78A9F3281EA9A12500197C26 /* Frameworks */ = { 91 | isa = PBXFrameworksBuildPhase; 92 | buildActionMask = 2147483647; 93 | files = ( 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | 78A9F3411EA9A12500197C26 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | 78A9F34C1EA9A12500197C26 /* Frameworks */ = { 105 | isa = PBXFrameworksBuildPhase; 106 | buildActionMask = 2147483647; 107 | files = ( 108 | ); 109 | runOnlyForDeploymentPostprocessing = 0; 110 | }; 111 | /* End PBXFrameworksBuildPhase section */ 112 | 113 | /* Begin PBXGroup section */ 114 | 78A9F3221EA9A12500197C26 = { 115 | isa = PBXGroup; 116 | children = ( 117 | 78A9F32D1EA9A12500197C26 /* NightMode */, 118 | 78A9F3471EA9A12500197C26 /* NightModeTests */, 119 | 78A9F3521EA9A12500197C26 /* NightModeUITests */, 120 | 78A9F32C1EA9A12500197C26 /* Products */, 121 | ); 122 | sourceTree = ""; 123 | }; 124 | 78A9F32C1EA9A12500197C26 /* Products */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 78A9F32B1EA9A12500197C26 /* NightMode.app */, 128 | 78A9F3441EA9A12500197C26 /* NightModeTests.xctest */, 129 | 78A9F34F1EA9A12500197C26 /* NightModeUITests.xctest */, 130 | ); 131 | name = Products; 132 | sourceTree = ""; 133 | }; 134 | 78A9F32D1EA9A12500197C26 /* NightMode */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 78A9F3641EA9AE4B00197C26 /* NightModeTheme */, 138 | 78A9F3311EA9A12500197C26 /* AppDelegate.h */, 139 | 78A9F3321EA9A12500197C26 /* AppDelegate.m */, 140 | 78A9F3611EA9A1E700197C26 /* RootViewController.h */, 141 | 78A9F3621EA9A1E700197C26 /* RootViewController.m */, 142 | 78A9F3771EAA02F300197C26 /* HomeViewController.h */, 143 | 78A9F3781EAA02F300197C26 /* HomeViewController.m */, 144 | 78A9F37A1EAA033D00197C26 /* SchemaViewController.h */, 145 | 78A9F37B1EAA033D00197C26 /* SchemaViewController.m */, 146 | 78A9F3741EA9FBB900197C26 /* NextCollectionViewController.h */, 147 | 78A9F3751EA9FBB900197C26 /* NextCollectionViewController.m */, 148 | 78A9F32E1EA9A12500197C26 /* Supporting Files */, 149 | 78A9F33A1EA9A12500197C26 /* Assets.xcassets */, 150 | 78A9F33C1EA9A12500197C26 /* LaunchScreen.storyboard */, 151 | 78A9F33F1EA9A12500197C26 /* Info.plist */, 152 | ); 153 | path = NightMode; 154 | sourceTree = ""; 155 | }; 156 | 78A9F32E1EA9A12500197C26 /* Supporting Files */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 78A9F32F1EA9A12500197C26 /* main.m */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | 78A9F3471EA9A12500197C26 /* NightModeTests */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 78A9F3481EA9A12500197C26 /* NightModeTests.m */, 168 | 78A9F34A1EA9A12500197C26 /* Info.plist */, 169 | ); 170 | path = NightModeTests; 171 | sourceTree = ""; 172 | }; 173 | 78A9F3521EA9A12500197C26 /* NightModeUITests */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 78A9F3531EA9A12500197C26 /* NightModeUITests.m */, 177 | 78A9F3551EA9A12500197C26 /* Info.plist */, 178 | ); 179 | path = NightModeUITests; 180 | sourceTree = ""; 181 | }; 182 | 78A9F3641EA9AE4B00197C26 /* NightModeTheme */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | 78A9F3651EA9D78B00197C26 /* Resource */, 186 | 78A9F36E1EA9E45900197C26 /* ThemeManage.h */, 187 | 78A9F36F1EA9E45900197C26 /* ThemeManage.m */, 188 | 78A9F3711EA9E73200197C26 /* UIView+ThemeChange.h */, 189 | 78A9F3721EA9E73200197C26 /* UIView+ThemeChange.m */, 190 | 78A9F3801EAD9FF400197C26 /* UINavigationBar+ThemeChange.h */, 191 | 78A9F3811EAD9FF400197C26 /* UINavigationBar+ThemeChange.m */, 192 | 78A9F3831EADA20700197C26 /* UITabBar+ThemeChange.h */, 193 | 78A9F3841EADA20700197C26 /* UITabBar+ThemeChange.m */, 194 | 78A9F37D1EAA054800197C26 /* UILabel+ThemeChange.h */, 195 | 78A9F37E1EAA054800197C26 /* UILabel+ThemeChange.m */, 196 | 78A9F3861EADA28900197C26 /* UIButton+ThemeChange.h */, 197 | 78A9F3871EADA28900197C26 /* UIButton+ThemeChange.m */, 198 | ); 199 | path = NightModeTheme; 200 | sourceTree = ""; 201 | }; 202 | 78A9F3651EA9D78B00197C26 /* Resource */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 78A9F3661EA9D97100197C26 /* schema@2x.png */, 206 | 78A9F3671EA9D97100197C26 /* day@2x.png */, 207 | 78A9F3681EA9D97100197C26 /* home@2x.png */, 208 | 78A9F3691EA9D97100197C26 /* night@2x.png */, 209 | ); 210 | path = Resource; 211 | sourceTree = ""; 212 | }; 213 | /* End PBXGroup section */ 214 | 215 | /* Begin PBXNativeTarget section */ 216 | 78A9F32A1EA9A12500197C26 /* NightMode */ = { 217 | isa = PBXNativeTarget; 218 | buildConfigurationList = 78A9F3581EA9A12500197C26 /* Build configuration list for PBXNativeTarget "NightMode" */; 219 | buildPhases = ( 220 | 78A9F3271EA9A12500197C26 /* Sources */, 221 | 78A9F3281EA9A12500197C26 /* Frameworks */, 222 | 78A9F3291EA9A12500197C26 /* Resources */, 223 | ); 224 | buildRules = ( 225 | ); 226 | dependencies = ( 227 | ); 228 | name = NightMode; 229 | productName = NightMode; 230 | productReference = 78A9F32B1EA9A12500197C26 /* NightMode.app */; 231 | productType = "com.apple.product-type.application"; 232 | }; 233 | 78A9F3431EA9A12500197C26 /* NightModeTests */ = { 234 | isa = PBXNativeTarget; 235 | buildConfigurationList = 78A9F35B1EA9A12500197C26 /* Build configuration list for PBXNativeTarget "NightModeTests" */; 236 | buildPhases = ( 237 | 78A9F3401EA9A12500197C26 /* Sources */, 238 | 78A9F3411EA9A12500197C26 /* Frameworks */, 239 | 78A9F3421EA9A12500197C26 /* Resources */, 240 | ); 241 | buildRules = ( 242 | ); 243 | dependencies = ( 244 | 78A9F3461EA9A12500197C26 /* PBXTargetDependency */, 245 | ); 246 | name = NightModeTests; 247 | productName = NightModeTests; 248 | productReference = 78A9F3441EA9A12500197C26 /* NightModeTests.xctest */; 249 | productType = "com.apple.product-type.bundle.unit-test"; 250 | }; 251 | 78A9F34E1EA9A12500197C26 /* NightModeUITests */ = { 252 | isa = PBXNativeTarget; 253 | buildConfigurationList = 78A9F35E1EA9A12500197C26 /* Build configuration list for PBXNativeTarget "NightModeUITests" */; 254 | buildPhases = ( 255 | 78A9F34B1EA9A12500197C26 /* Sources */, 256 | 78A9F34C1EA9A12500197C26 /* Frameworks */, 257 | 78A9F34D1EA9A12500197C26 /* Resources */, 258 | ); 259 | buildRules = ( 260 | ); 261 | dependencies = ( 262 | 78A9F3511EA9A12500197C26 /* PBXTargetDependency */, 263 | ); 264 | name = NightModeUITests; 265 | productName = NightModeUITests; 266 | productReference = 78A9F34F1EA9A12500197C26 /* NightModeUITests.xctest */; 267 | productType = "com.apple.product-type.bundle.ui-testing"; 268 | }; 269 | /* End PBXNativeTarget section */ 270 | 271 | /* Begin PBXProject section */ 272 | 78A9F3231EA9A12500197C26 /* Project object */ = { 273 | isa = PBXProject; 274 | attributes = { 275 | LastUpgradeCheck = 0830; 276 | ORGANIZATIONNAME = ZL; 277 | TargetAttributes = { 278 | 78A9F32A1EA9A12500197C26 = { 279 | CreatedOnToolsVersion = 8.3.2; 280 | DevelopmentTeam = 7734U6Q8V5; 281 | ProvisioningStyle = Automatic; 282 | }; 283 | 78A9F3431EA9A12500197C26 = { 284 | CreatedOnToolsVersion = 8.3.2; 285 | DevelopmentTeam = 7734U6Q8V5; 286 | ProvisioningStyle = Automatic; 287 | TestTargetID = 78A9F32A1EA9A12500197C26; 288 | }; 289 | 78A9F34E1EA9A12500197C26 = { 290 | CreatedOnToolsVersion = 8.3.2; 291 | DevelopmentTeam = 7734U6Q8V5; 292 | ProvisioningStyle = Automatic; 293 | TestTargetID = 78A9F32A1EA9A12500197C26; 294 | }; 295 | }; 296 | }; 297 | buildConfigurationList = 78A9F3261EA9A12500197C26 /* Build configuration list for PBXProject "NightMode" */; 298 | compatibilityVersion = "Xcode 3.2"; 299 | developmentRegion = English; 300 | hasScannedForEncodings = 0; 301 | knownRegions = ( 302 | en, 303 | Base, 304 | ); 305 | mainGroup = 78A9F3221EA9A12500197C26; 306 | productRefGroup = 78A9F32C1EA9A12500197C26 /* Products */; 307 | projectDirPath = ""; 308 | projectRoot = ""; 309 | targets = ( 310 | 78A9F32A1EA9A12500197C26 /* NightMode */, 311 | 78A9F3431EA9A12500197C26 /* NightModeTests */, 312 | 78A9F34E1EA9A12500197C26 /* NightModeUITests */, 313 | ); 314 | }; 315 | /* End PBXProject section */ 316 | 317 | /* Begin PBXResourcesBuildPhase section */ 318 | 78A9F3291EA9A12500197C26 /* Resources */ = { 319 | isa = PBXResourcesBuildPhase; 320 | buildActionMask = 2147483647; 321 | files = ( 322 | 78A9F36C1EA9D97100197C26 /* home@2x.png in Resources */, 323 | 78A9F33E1EA9A12500197C26 /* LaunchScreen.storyboard in Resources */, 324 | 78A9F36B1EA9D97100197C26 /* day@2x.png in Resources */, 325 | 78A9F33B1EA9A12500197C26 /* Assets.xcassets in Resources */, 326 | 78A9F36A1EA9D97100197C26 /* schema@2x.png in Resources */, 327 | 78A9F36D1EA9D97100197C26 /* night@2x.png in Resources */, 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | }; 331 | 78A9F3421EA9A12500197C26 /* Resources */ = { 332 | isa = PBXResourcesBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | }; 338 | 78A9F34D1EA9A12500197C26 /* Resources */ = { 339 | isa = PBXResourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | ); 343 | runOnlyForDeploymentPostprocessing = 0; 344 | }; 345 | /* End PBXResourcesBuildPhase section */ 346 | 347 | /* Begin PBXSourcesBuildPhase section */ 348 | 78A9F3271EA9A12500197C26 /* Sources */ = { 349 | isa = PBXSourcesBuildPhase; 350 | buildActionMask = 2147483647; 351 | files = ( 352 | 78A9F37F1EAA054800197C26 /* UILabel+ThemeChange.m in Sources */, 353 | 78A9F3701EA9E45900197C26 /* ThemeManage.m in Sources */, 354 | 78A9F37C1EAA033D00197C26 /* SchemaViewController.m in Sources */, 355 | 78A9F3331EA9A12500197C26 /* AppDelegate.m in Sources */, 356 | 78A9F3631EA9A1E700197C26 /* RootViewController.m in Sources */, 357 | 78A9F3761EA9FBB900197C26 /* NextCollectionViewController.m in Sources */, 358 | 78A9F3301EA9A12500197C26 /* main.m in Sources */, 359 | 78A9F3851EADA20700197C26 /* UITabBar+ThemeChange.m in Sources */, 360 | 78A9F3821EAD9FF400197C26 /* UINavigationBar+ThemeChange.m in Sources */, 361 | 78A9F3791EAA02F300197C26 /* HomeViewController.m in Sources */, 362 | 78A9F3731EA9E73200197C26 /* UIView+ThemeChange.m in Sources */, 363 | 78A9F3881EADA28900197C26 /* UIButton+ThemeChange.m in Sources */, 364 | ); 365 | runOnlyForDeploymentPostprocessing = 0; 366 | }; 367 | 78A9F3401EA9A12500197C26 /* Sources */ = { 368 | isa = PBXSourcesBuildPhase; 369 | buildActionMask = 2147483647; 370 | files = ( 371 | 78A9F3491EA9A12500197C26 /* NightModeTests.m in Sources */, 372 | ); 373 | runOnlyForDeploymentPostprocessing = 0; 374 | }; 375 | 78A9F34B1EA9A12500197C26 /* Sources */ = { 376 | isa = PBXSourcesBuildPhase; 377 | buildActionMask = 2147483647; 378 | files = ( 379 | 78A9F3541EA9A12500197C26 /* NightModeUITests.m in Sources */, 380 | ); 381 | runOnlyForDeploymentPostprocessing = 0; 382 | }; 383 | /* End PBXSourcesBuildPhase section */ 384 | 385 | /* Begin PBXTargetDependency section */ 386 | 78A9F3461EA9A12500197C26 /* PBXTargetDependency */ = { 387 | isa = PBXTargetDependency; 388 | target = 78A9F32A1EA9A12500197C26 /* NightMode */; 389 | targetProxy = 78A9F3451EA9A12500197C26 /* PBXContainerItemProxy */; 390 | }; 391 | 78A9F3511EA9A12500197C26 /* PBXTargetDependency */ = { 392 | isa = PBXTargetDependency; 393 | target = 78A9F32A1EA9A12500197C26 /* NightMode */; 394 | targetProxy = 78A9F3501EA9A12500197C26 /* PBXContainerItemProxy */; 395 | }; 396 | /* End PBXTargetDependency section */ 397 | 398 | /* Begin PBXVariantGroup section */ 399 | 78A9F33C1EA9A12500197C26 /* LaunchScreen.storyboard */ = { 400 | isa = PBXVariantGroup; 401 | children = ( 402 | 78A9F33D1EA9A12500197C26 /* Base */, 403 | ); 404 | name = LaunchScreen.storyboard; 405 | sourceTree = ""; 406 | }; 407 | /* End PBXVariantGroup section */ 408 | 409 | /* Begin XCBuildConfiguration section */ 410 | 78A9F3561EA9A12500197C26 /* Debug */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | ALWAYS_SEARCH_USER_PATHS = NO; 414 | CLANG_ANALYZER_NONNULL = YES; 415 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 416 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 417 | CLANG_CXX_LIBRARY = "libc++"; 418 | CLANG_ENABLE_MODULES = YES; 419 | CLANG_ENABLE_OBJC_ARC = YES; 420 | CLANG_WARN_BOOL_CONVERSION = YES; 421 | CLANG_WARN_CONSTANT_CONVERSION = YES; 422 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 423 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 424 | CLANG_WARN_EMPTY_BODY = YES; 425 | CLANG_WARN_ENUM_CONVERSION = YES; 426 | CLANG_WARN_INFINITE_RECURSION = YES; 427 | CLANG_WARN_INT_CONVERSION = YES; 428 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 429 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 430 | CLANG_WARN_UNREACHABLE_CODE = YES; 431 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 432 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 433 | COPY_PHASE_STRIP = NO; 434 | DEBUG_INFORMATION_FORMAT = dwarf; 435 | ENABLE_STRICT_OBJC_MSGSEND = YES; 436 | ENABLE_TESTABILITY = YES; 437 | GCC_C_LANGUAGE_STANDARD = gnu99; 438 | GCC_DYNAMIC_NO_PIC = NO; 439 | GCC_NO_COMMON_BLOCKS = YES; 440 | GCC_OPTIMIZATION_LEVEL = 0; 441 | GCC_PREPROCESSOR_DEFINITIONS = ( 442 | "DEBUG=1", 443 | "$(inherited)", 444 | ); 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 452 | MTL_ENABLE_DEBUG_INFO = YES; 453 | ONLY_ACTIVE_ARCH = YES; 454 | SDKROOT = iphoneos; 455 | }; 456 | name = Debug; 457 | }; 458 | 78A9F3571EA9A12500197C26 /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ALWAYS_SEARCH_USER_PATHS = NO; 462 | CLANG_ANALYZER_NONNULL = YES; 463 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 464 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 465 | CLANG_CXX_LIBRARY = "libc++"; 466 | CLANG_ENABLE_MODULES = YES; 467 | CLANG_ENABLE_OBJC_ARC = YES; 468 | CLANG_WARN_BOOL_CONVERSION = YES; 469 | CLANG_WARN_CONSTANT_CONVERSION = YES; 470 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 471 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 472 | CLANG_WARN_EMPTY_BODY = YES; 473 | CLANG_WARN_ENUM_CONVERSION = YES; 474 | CLANG_WARN_INFINITE_RECURSION = YES; 475 | CLANG_WARN_INT_CONVERSION = YES; 476 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 477 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 478 | CLANG_WARN_UNREACHABLE_CODE = YES; 479 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 480 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 481 | COPY_PHASE_STRIP = NO; 482 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 483 | ENABLE_NS_ASSERTIONS = NO; 484 | ENABLE_STRICT_OBJC_MSGSEND = YES; 485 | GCC_C_LANGUAGE_STANDARD = gnu99; 486 | GCC_NO_COMMON_BLOCKS = YES; 487 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 488 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 489 | GCC_WARN_UNDECLARED_SELECTOR = YES; 490 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 491 | GCC_WARN_UNUSED_FUNCTION = YES; 492 | GCC_WARN_UNUSED_VARIABLE = YES; 493 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 494 | MTL_ENABLE_DEBUG_INFO = NO; 495 | SDKROOT = iphoneos; 496 | VALIDATE_PRODUCT = YES; 497 | }; 498 | name = Release; 499 | }; 500 | 78A9F3591EA9A12500197C26 /* Debug */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | DEVELOPMENT_TEAM = 7734U6Q8V5; 505 | INFOPLIST_FILE = NightMode/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 507 | PRODUCT_BUNDLE_IDENTIFIER = com.zhangli.NightMode; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | }; 510 | name = Debug; 511 | }; 512 | 78A9F35A1EA9A12500197C26 /* Release */ = { 513 | isa = XCBuildConfiguration; 514 | buildSettings = { 515 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 516 | DEVELOPMENT_TEAM = 7734U6Q8V5; 517 | INFOPLIST_FILE = NightMode/Info.plist; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 519 | PRODUCT_BUNDLE_IDENTIFIER = com.zhangli.NightMode; 520 | PRODUCT_NAME = "$(TARGET_NAME)"; 521 | }; 522 | name = Release; 523 | }; 524 | 78A9F35C1EA9A12500197C26 /* Debug */ = { 525 | isa = XCBuildConfiguration; 526 | buildSettings = { 527 | BUNDLE_LOADER = "$(TEST_HOST)"; 528 | DEVELOPMENT_TEAM = 7734U6Q8V5; 529 | INFOPLIST_FILE = NightModeTests/Info.plist; 530 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 531 | PRODUCT_BUNDLE_IDENTIFIER = com.zhangli.NightModeTests; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NightMode.app/NightMode"; 534 | }; 535 | name = Debug; 536 | }; 537 | 78A9F35D1EA9A12500197C26 /* Release */ = { 538 | isa = XCBuildConfiguration; 539 | buildSettings = { 540 | BUNDLE_LOADER = "$(TEST_HOST)"; 541 | DEVELOPMENT_TEAM = 7734U6Q8V5; 542 | INFOPLIST_FILE = NightModeTests/Info.plist; 543 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 544 | PRODUCT_BUNDLE_IDENTIFIER = com.zhangli.NightModeTests; 545 | PRODUCT_NAME = "$(TARGET_NAME)"; 546 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NightMode.app/NightMode"; 547 | }; 548 | name = Release; 549 | }; 550 | 78A9F35F1EA9A12500197C26 /* Debug */ = { 551 | isa = XCBuildConfiguration; 552 | buildSettings = { 553 | DEVELOPMENT_TEAM = 7734U6Q8V5; 554 | INFOPLIST_FILE = NightModeUITests/Info.plist; 555 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 556 | PRODUCT_BUNDLE_IDENTIFIER = com.zhangli.NightModeUITests; 557 | PRODUCT_NAME = "$(TARGET_NAME)"; 558 | TEST_TARGET_NAME = NightMode; 559 | }; 560 | name = Debug; 561 | }; 562 | 78A9F3601EA9A12500197C26 /* Release */ = { 563 | isa = XCBuildConfiguration; 564 | buildSettings = { 565 | DEVELOPMENT_TEAM = 7734U6Q8V5; 566 | INFOPLIST_FILE = NightModeUITests/Info.plist; 567 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 568 | PRODUCT_BUNDLE_IDENTIFIER = com.zhangli.NightModeUITests; 569 | PRODUCT_NAME = "$(TARGET_NAME)"; 570 | TEST_TARGET_NAME = NightMode; 571 | }; 572 | name = Release; 573 | }; 574 | /* End XCBuildConfiguration section */ 575 | 576 | /* Begin XCConfigurationList section */ 577 | 78A9F3261EA9A12500197C26 /* Build configuration list for PBXProject "NightMode" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | 78A9F3561EA9A12500197C26 /* Debug */, 581 | 78A9F3571EA9A12500197C26 /* Release */, 582 | ); 583 | defaultConfigurationIsVisible = 0; 584 | defaultConfigurationName = Release; 585 | }; 586 | 78A9F3581EA9A12500197C26 /* Build configuration list for PBXNativeTarget "NightMode" */ = { 587 | isa = XCConfigurationList; 588 | buildConfigurations = ( 589 | 78A9F3591EA9A12500197C26 /* Debug */, 590 | 78A9F35A1EA9A12500197C26 /* Release */, 591 | ); 592 | defaultConfigurationIsVisible = 0; 593 | }; 594 | 78A9F35B1EA9A12500197C26 /* Build configuration list for PBXNativeTarget "NightModeTests" */ = { 595 | isa = XCConfigurationList; 596 | buildConfigurations = ( 597 | 78A9F35C1EA9A12500197C26 /* Debug */, 598 | 78A9F35D1EA9A12500197C26 /* Release */, 599 | ); 600 | defaultConfigurationIsVisible = 0; 601 | }; 602 | 78A9F35E1EA9A12500197C26 /* Build configuration list for PBXNativeTarget "NightModeUITests" */ = { 603 | isa = XCConfigurationList; 604 | buildConfigurations = ( 605 | 78A9F35F1EA9A12500197C26 /* Debug */, 606 | 78A9F3601EA9A12500197C26 /* Release */, 607 | ); 608 | defaultConfigurationIsVisible = 0; 609 | }; 610 | /* End XCConfigurationList section */ 611 | }; 612 | rootObject = 78A9F3231EA9A12500197C26 /* Project object */; 613 | } 614 | --------------------------------------------------------------------------------