ColorWithHex 3.0.1

ColorWithHex 3.0.1

测试已测试
语言语言 SwiftSwift
授权 MIT
发布最后发布2016 年 10 月
SwiftSwift 版本3.0
SPM支持 SPM

Gabriel Massana 维护。



  • Gabriel Massana

ColorWithHex-iOS

这是什么?

Swift 扩展,用于将十六进制值转换为 UIColor 对象。

支持的十六进制格式

  • 短十六进制: rgb
  • 带短十六进制号的: #rgb
  • 十六进制: rrggbb
  • 带十六进制号的: #rrggbb
  • 带 Alpha 的十六进制: rrggbbaa
  • 带 Alpha 的带十六进制号的: #rrggbbaa

安装

Podfile

platform :ios, '8.0'
use_frameworks!

pod 'ColorWithHex', '~> 0.0'

然后,运行以下命令

$ pod install

旧方法

/ColorWithHex-iOS 文件夹拖入您的项目中。就这样。

Swift 例子

        let shortHexHash: UIColor = UIColor.colorWithHex("#f80")
        let shortHex: UIColor  = UIColor.colorWithHex("f80")
        let hex: UIColor  = UIColor.colorWithHex("ff8800")
        let hexAlpha: UIColor  = UIColor.colorWithHex("ff880080")
        let hexHash: UIColor  = UIColor.colorWithHex("#20aa45")
        let hexHashAlpha: UIColor  = UIColor.colorWithHex("#20aa4580")

Objective-C 例子

#import "ColorWithHex-Swift.h"

...

        UIColor *shortHexHash = [UIColor cwh_colorWithHex: @"#f80"];
        UIColor *shortHex = [UIColor cwh_colorWithHex: @"f80"];
        UIColor *hex = [UIColor cwh_colorWithHex: @"ff8800"];
        UIColor *hexAlpha = [UIColor cwh_colorWithHex: @"ff880080"];
        UIColor *hexAlpha = [UIColor cwh_colorWithHex: @"#20aa45"];
        UIColor *hexHash = [UIColor cwh_colorWithHex: @"#20aa4580"];

授权

ColorWithHex-iOS 在 MIT 授权下发布。请参阅名为 LICENSE 的文件。

版本

$ git tag -a 2.0.0 -m 'Version 0.0.0'

$ git push --tags

作者

Gabriel Massana

发现了一个问题?

如果遇到特定于 ColorWithHex-iOS 的问题,或有功能请求,或想分享意见,请在此处新建 问题