为你的iOS应用添加夜间模式的框架:DKNightVersion

n6bg 9年前

DKNightVersion是一个轻量级的框架能够为你的iOS应用添加夜间模式。这个框架的很多代码都是由Ruby脚本生成。

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like DKNightVersion in your projects. See the Get Started section for more details.

Podfile

pod "DKNightVersion", "~> 0.4.5"

Usage

#import "DKNightVersion.h"

How to use

API documentation is not available now.

Using night color

This framework is based on a propertynightColor, such asnightBackgroundColornightTextColor...

Assign the night version color you want to theUIKitcomponent:

self.view.nightBackgroundColor = [UIColor blackColor];  self.label.nightTextColor = [UIColor whiteColor];

Using DKNightVersionManager change theme

UseDKNightVersionManagersets the theme.

[DKNightVersionManager nightFalling];

If you'd like to switch back to normal theme version:

[DKNightVersionManager dawnComing];

项目主页:http://www.open-open.com/lib/view/home/1430375382974