iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Draven
V2EX  ›  iDev

DKNightVersion ---- 一个为 iOS 应用添加夜间模式的框架, 求 star = =, 求轻喷

  •  1
     
  •   Draven ·
    draveness · May 5, 2015 · 4194 views
    This topic created in 4029 days ago, the information mentioned may be changed or developed.

    DKNightVersion 现在已经更新到了 0.5.7, 支持大多数的 UIKit 控件的夜间模式功能.

    它为所有的 UIKit 的组件的 color 颜色添加了一个对应的 nightColor 属性, 我们可以直接设置对应的 nightColor 属性.

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

    这样在调用 DKNightVersionManager 的类方法 nightFalling 的时候就会自动将所有的颜色转化为夜间模式, 并将原来的正常模式下的颜色存储下来, 以便之后再次切换回夜间模式.

    [DKNightVersionManager nightFalling];
    

    如果没有设置夜间模式的颜色, 那么我们也可以使用默认的夜间配色.

    框架的大部分代码是通过 ruby 脚本自动生成的, 如果你需要修改默认的配色, 只需要修改目录下 的 property.json 文件中对应的属性, 运行 rake 命令, 就会为你重新生成代码.

    放一张效果图, 最后默默的求一下 star DKNightVersion :) 轻喷 =_=

    Supplement 1  ·  May 7, 2015
    1 replies    2015-05-06 15:59:18 +08:00
    kepenj
        1
    kepenj  
       May 6, 2015
    nice
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3126 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 03:45 · PVG 11:45 · LAX 20:45 · JFK 23:45
    ♥ Do have faith in what you're doing.