Commit 32a2c5c7 authored by David黄金龙's avatar David黄金龙

Merge branch 'davidhuang' into develop

parents 49652be5 28a6fb59
......@@ -38,7 +38,7 @@ extension YHTabBarViewController {
//展示tabbar上的横线
func handleTabBarLine() -> Void {
let rect = CGRect.init(x:0,y:0,width:KScreenWidth,height:0.5)
let fillColor = YHColorWithHex(0x888888)
let fillColor = UIColor(hex:0x888888)
let img = UIImage.from(color: fillColor, rect: rect)
UIView.transition(with:self.tabBar, duration:0.5, options: .transitionCrossDissolve) {
......
......@@ -18,7 +18,7 @@ class YHHomeViewController: YHBaseViewController {
func initView()->Void {
navigationItem.title = "首页"
// view.backgroundColor = YHColorWithHex(0xE9E9E9)
view.backgroundColor = UIColor(hex:0xE9E9E9)
}
}
......@@ -21,7 +21,7 @@ class YHIntelligentServiceViewController: YHBaseViewController {
func initView() {
navigationItem.title = "智慧服务"
view.backgroundColor = YHColorWithHex(0xE9E9E9)
view.backgroundColor = UIColor(hex:0xE9E9E9)
......
......@@ -43,7 +43,7 @@ class YHLoginViewController: YHBaseViewController {
let label = UILabel()
label.text = "登录后更精彩"
label.font = kBoldFont(size: 32)
label.textColor = YHColorWithHex(0xffffff)
label.textColor = UIColor(hex:0xffffff)
return label
}()
view.addSubview(loginTitleLabel)
......@@ -57,7 +57,7 @@ class YHLoginViewController: YHBaseViewController {
let label = UILabel()
label.text = "香港美好生活期待与你的相遇"
label.font = kFont(size: 20)
label.textColor = YHColorWithHex(0xffffff)
label.textColor = UIColor(hex:0xffffff)
return label
}()
view.addSubview(loginSubTitleLabel)
......@@ -72,7 +72,7 @@ class YHLoginViewController: YHBaseViewController {
label.text = "+86 133****3800"
label.font = kBoldFont(size: 20)
label.textAlignment = .center
label.textColor = YHColorWithHex(0xffffff)
label.textColor = UIColor(hex:0xffffff)
return label
}()
view.addSubview(loginPhoneLabel)
......@@ -84,11 +84,11 @@ class YHLoginViewController: YHBaseViewController {
}
loginButton = {
let button = UIButton(type: .custom)
button.backgroundColor = YHColorWithHex(0x4d9ff8)
button.backgroundColor = UIColor(hex:0x4d9ff8)
button.titleLabel?.font = kBoldFont(size: 16)
button.contentHorizontalAlignment = .center
button.setTitle("本机号码一键登录", for: .normal)
button.setTitleColor(YHColorWithHex(0xffffff), for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = 24
return button
}()
......@@ -101,7 +101,7 @@ class YHLoginViewController: YHBaseViewController {
}
centerLine = {
let view = UIView()
view.backgroundColor = YHColorWithHex(0xffffff)
view.backgroundColor = UIColor(hex:0xffffff)
return view
}()
view.addSubview(centerLine)
......@@ -151,7 +151,7 @@ class YHLoginViewController: YHBaseViewController {
let label = UILabel()
label.text = "其他登录方式(第三方账号注册需绑定手机号)"
label.font = kFont(size: 12)
label.textColor = YHColorWithHex(0xffffff)
label.textColor = UIColor(hex:0xffffff)
label.textAlignment = .center
return label
}()
......
......@@ -43,7 +43,7 @@ class YHLoginPrivacyView: UIView {
let label = UILabel()
label.text = "我已阅读并同意"
label.font = kFont(size: 12)
label.textColor = YHColorWithHex(0xffffff)
label.textColor = UIColor(hex:0xffffff)
label.textAlignment = .left
return label
}()
......@@ -72,7 +72,7 @@ class YHLoginPrivacyView: UIView {
let label = UILabel()
label.text = "和"
label.font = kFont(size: 12)
label.textColor = YHColorWithHex(0xffffff)
label.textColor = UIColor(hex:0xffffff)
label.textAlignment = .left
return label
}()
......
......@@ -33,7 +33,7 @@ class YHLoginStyleButton: UIButton {
messageLabel = {
let label = UILabel()
label.font = kBoldFont(size: 16)
label.textColor = YHColorWithHex(0xffffff)
label.textColor = UIColor(hex:0xffffff)
label.textAlignment = .right
return label
}()
......
......@@ -17,7 +17,7 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style:.plain)
tableView.backgroundColor = YHColorWithHex(0xE9E9E9)
tableView.backgroundColor = UIColor(hex: 0xE9E9E9)//UIColor(hux:0xE9E9E9)
tableView.separatorStyle = .none
tableView.register(YHPersonalCenterCell.self, forCellReuseIdentifier: YHPersonalCenterCell.cellReuseIdentifier)
tableView.delegate = self
......@@ -56,7 +56,7 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
func initView() {
navigationItem.title = "我的"
view.backgroundColor = YHColorWithHex(0xE9E9E9)
view.backgroundColor = UIColor(hex:0xE9E9E9)
view.addSubview(tableView);
......
......@@ -85,15 +85,15 @@ extension UIButton {
btn.setTitleColor(lightSelectColor, for: [.highlighted,.selected])
btn.setBackgroundImage(bgNormalColor?.imageWithColor(), for: .normal)
btn.setBackgroundImage(bgSelectColor?.imageWithColor(), for: .selected)
btn.setBackgroundImage(bgLightNormalColor?.imageWithColor(), for: [.highlighted,.normal])
btn.setBackgroundImage(bgNormalColor?.toImage(), for: .normal)
btn.setBackgroundImage(bgSelectColor?.toImage(), for: .selected)
btn.setBackgroundImage(bgLightNormalColor?.toImage(), for: [.highlighted,.normal])
if bgLightNormalColor == nil {
btn.setBackgroundImage(bgNormalColor?.withAlphaComponent(0.9).imageWithColor(), for: [.highlighted,.normal])
btn.setBackgroundImage(bgNormalColor?.withAlphaComponent(0.9).toImage(), for: [.highlighted,.normal])
}
btn.setBackgroundImage(bgLightSelectColor?.imageWithColor(), for: [.highlighted,.selected])
btn.setBackgroundImage(bgLightSelectColor?.toImage(), for: [.highlighted,.selected])
if bgLightSelectColor == nil {
btn.setBackgroundImage(bgSelectColor?.withAlphaComponent(0.9).imageWithColor(), for: [.highlighted,.selected])
btn.setBackgroundImage(bgSelectColor?.withAlphaComponent(0.9).toImage(), for: [.highlighted,.selected])
}
return btn
......
......@@ -33,11 +33,18 @@ extension UIColor {
static let black50Persent : UIColor = UIColor.black.withAlphaComponent(0.5)
public convenience init(r : CGFloat, g : CGFloat, b : CGFloat) {
self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: 1.0)
public convenience init(r : CGFloat, g : CGFloat, b : CGFloat,alpha:CGFloat = 1.0) {
self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha)
}
public func imageWithColor(width: Double = 1.0, height: Double = 1.0) -> UIImage {
// 根据色值生成颜色(无透明度)(格式为0xffffff)
public convenience init(hex : NSInteger,alpha:CGFloat = 1.0) {
self.init(red: ((CGFloat)((hex & 0xFF0000) >> 16)) / 255.0, green: ((CGFloat)((hex & 0xFF00) >> 8)) / 255.0, blue: ((CGFloat)(hex & 0xFF)) / 255.0, alpha: alpha)
}
//生成 对应色值的图片
public func toImage(width: Double = 1.0, height: Double = 1.0) -> UIImage {
let rect = CGRect(x: 0.0, y: 0.0, width: width, height: height)
UIGraphicsBeginImageContext(rect.size)
let ctx = UIGraphicsGetCurrentContext()
......
......@@ -134,21 +134,6 @@ func isIphoneX() -> Bool {
return k_Height_safeAreaInsetsBottom() > 0.0 // 底部安全区 > 0 时,
}
/// 根据RGBA生成颜色(格式为:22,22,22,0.5)
var YHRGBAColor: (CGFloat, CGFloat, CGFloat, CGFloat) -> UIColor = {red, green, blue, alpha in
return UIColor(red: red / 255, green: green / 255, blue: blue / 255, alpha: alpha)
}
/// 根据RGB生成颜色(格式为:22,22,22)
var YHRGBColor: (CGFloat, CGFloat, CGFloat) -> UIColor = {red, green, blue in
return UIColor(red: red / 255, green: green / 255, blue: blue / 255, alpha: 1)
}
/// 根据色值生成颜色(无透明度)(格式为0xffffff)
var YHColorWithHex: (NSInteger) -> UIColor = {hex in
return UIColor(red: ((CGFloat)((hex & 0xFF0000) >> 16)) / 255.0, green: ((CGFloat)((hex & 0xFF00) >> 8)) / 255.0, blue: ((CGFloat)(hex & 0xFF)) / 255.0, alpha: 1)
}
class YhConstant {
// MARK: - URL 相关
struct URL {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment