兵马未动,粮草先行。直接上代码,个人在学习,也希望对你有用。
import UIKit
//MARK: - AppColor 相关
public enum AppColor {
static let clear = UIColor.clear
//APP主题色
static let main = Color_Hex(value: 0xfd2e2e)
//APP灰色
static let gray = Color_Hex(value: 0xf9f9f9)
//APP轻灰色
static let lightGray = Color_Hex(value: 0xf5f5f5)
//APP黑色
static let black = Color_Hex(value: 0x333333)
//APP深灰色
static let darkgGray = Color_Hex(value: 0x666666)
}
//RGBA 设置颜色
public func RGB(R:CGFloat,G:CGFloat,B:CGFloat) ->UIColor {
return RGBA(R: R, G: G, B: B, A: 1.0)
}
public func RGBA(R:CGFloat,G:CGFloat,B:CGFloat,A:CGFloat) ->UIColor {
return UIColor.init(red: R/255.0, green: G/255.0, blue: B/255.0, alpha: A)
}
///16进制色号 设置颜色 示例:UIColorHex(0x26A7E8)
public func Color_Hex(value:UInt32) -> UIColor{
return Color_Hex_A(value: value, alpha: 1.0)
}
public func Color_Hex_A(value:UInt32, alpha:CGFloat) -> UIColor{
let color = UIColor.init(red: (((CGFloat)((value & 0xFF0000) >> 16)) / 255.0), green: (((CGFloat)((value & 0xFF0000) >> 16)) / 255.0), blue: (((CGFloat)((value & 0xFF0000) >> 16)) / 255.0), alpha: alpha)
return color
}
swift UITabBarController -------(项目准备-学习1)
swift 适配问题 -------(项目准备-学习2)