Header.swift 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // Header.swift
  3. // HuiKaoBa
  4. //
  5. // Created by Tony on 16/11/17.
  6. // Copyright © 2016年 Tony. All rights reserved.
  7. //
  8. import UIKit
  9. /** 屏幕尺寸 */
  10. // 屏幕宽度
  11. let SCREEN_HEIGHT = UIScreen.main.bounds.size.height
  12. // 屏幕高度
  13. let SCREEN_WIDTH = UIScreen.main.bounds.size.width
  14. // 自适应屏幕宽度
  15. func FIT_SCREEN_WIDTH(_ size: CGFloat) -> CGFloat {
  16. return size * SCREEN_WIDTH / 375.0
  17. }
  18. // 自适应屏幕高度
  19. func FIT_SCREEN_HEIGHT(_ size: CGFloat) -> CGFloat {
  20. return size * SCREEN_HEIGHT / 667.0
  21. }
  22. // 自适应屏幕字体大小
  23. func AUTO_FONT(_ size: CGFloat) -> UIFont {
  24. let autoSize = size * SCREEN_WIDTH / 375.0
  25. return UIFont.systemFont(ofSize: autoSize)
  26. }
  27. //屏幕-宽-高-bounds
  28. public let kScreenWidth = UIScreen.main.bounds.size.width
  29. public let kScreenHeight = UIScreen.main.bounds.size.height
  30. public let ScreenBounds: CGRect = UIScreen.main.bounds
  31. //navigation
  32. public let NavigationH: CGFloat = 64
  33. //全局整体背景色
  34. public let GlobalBackgroundColor = UIColor.colorWithCustom(r: 239, g: 239, b: 239)
  35. //cell分割线颜色
  36. public let CellDivisionColor = UIColor.lightGray
  37. /** 颜色值 */
  38. // RGB颜色
  39. func RGB_COLOR(_ r: CGFloat, g: CGFloat, b: CGFloat, alpha: CGFloat) -> UIColor {
  40. return UIColor(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha)
  41. }
  42. // 项目主颜色
  43. func MAIN_COLOR() -> UIColor {
  44. return UIColor(red: 74/255.0, green: 163/255.0, blue: 243/255.0, alpha: 1.0)
  45. }
  46. /** 一级文字颜色 */
  47. func Font_Color_First() -> UIColor {
  48. return UIColor(red: 51.0/255.0, green: 51.0/255.0, blue: 51.0/255.0, alpha: 1.0)
  49. }
  50. /** 二级文字颜色 */
  51. func Font_Color_Second() -> UIColor {
  52. return UIColor(red: 102.0/255.0, green: 102.0/255.0, blue: 102.0/255.0, alpha: 1.0)
  53. }
  54. /** 三级文字颜色 */
  55. func Font_Color_Third() -> UIColor {
  56. return UIColor(red: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 1.0)
  57. }
  58. /** 分割线颜色 */
  59. func Line_COLOR() -> UIColor {
  60. return UIColor(red: 221.0/255.0, green: 221.0/255.0, blue: 221.0/255.0, alpha: 1.0)
  61. }
  62. // 灰色背景
  63. func GRAY_COLOR() -> UIColor {
  64. return UIColor(red: 242/255.0, green: 243/255.0, blue: 248/255.0, alpha: 1.0)
  65. }