Giter Club home page Giter Club logo

hctheme's Introduction

HCTheme

主题模式切换框架,支持控件Color及Image自动切换

使用前请先下载、运行并查看Demo。

【Demo演示】

演示1

/**********************************************************************/

【手动导入】

手动导入Theme文件夹,根据业务拓展HCTheme.swift / ThemeColor.plist / ThemeImage.plist 即可

/**********************************************************************/

方法说明

  1. 在AppDelegate中初始化主题模式
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // 初始化主题模式
    HCThemeManager.share.configThemeType(.night)
    return true
}
  1. 在业务中设置控件的颜色及颜色切换
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = HCThemeCell.cellWithTableView(tableView: tableView)
    // 控件图片切换
    cell.titleImage.hc_Image = HCTheme.Image.App_Store
    // 控件背景色及字体颜色切换
    cell.titleLab.hc_TextColor = HCTheme.Color.keyWord
    cell.contentView.hc_BackgroundColor = HCTheme.Color.pageBg

    return cell
}
  1. 切换主题
@objc func changeBtnClick() {
    let theme = HCThemeManager.share.current == HCTheme.night ? HCTheme.normal : HCTheme.night
    // 切换主题
    HCThemeManager.share.configThemeType(theme)
}
  1. 根据业务拓展HCTheme.swift / ThemeColor.plist / ThemeImage.plist 文件

/**********************************************************************/

【示例】

请下载、运行并查看Demo

/**********************************************************************/

【贡献】

如果您发现了bug或需要帮助,请打开一个issue或者提交一个pull request,十分感谢

hctheme's People

Contributors

zuolufei avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.