Explorar el Código

优化新闻页面UI

Vincent Hu hace 1 semana
padre
commit
e7f93b1588

+ 6 - 6
Koala/Koala/Modular/Information/C/InformationDetailViewController.swift

@@ -146,12 +146,12 @@ extension InformationDetailViewController: UITableViewDataSource, UITableViewDel
             let v = UIView(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 40))
             
             let topV = UIView(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 5))
-            topV.backgroundColor = _color("#F6FAFE&#F6FAFE")
+            topV.backgroundColor = Color(0xF6FAFE)
             v.addSubview(topV)
             
             let tLb = UILabel()
-            tLb.textColor = TitleTextColor
-            tLb.setTextFont(.PFSM, 14)
+            tLb.textColor = Color(0x333333)
+            tLb.font = .pf_14_medium
             tLb.text = switchLanguage("推荐阅读")
                 
             v.addSubview(tLb)
@@ -183,10 +183,10 @@ extension InformationDetailViewController: UITableViewDataSource, UITableViewDel
             // 行间距
             paraph.lineSpacing = 5
             // 样式属性集合
-            let attributes = [NSAttributedString.Key.font: _PFSR(18),
-                              NSAttributedString.Key.foregroundColor: _color("#3D3C3C&#3D3C3C"),
+            let attributes = [NSAttributedString.Key.font: UIFont.pf_16_regular,
+                              NSAttributedString.Key.foregroundColor: Color(0x3D3C3C),
                               NSAttributedString.Key.paragraphStyle: paraph]
-            cell.contentLb.attributedText = NSAttributedString(string: content, attributes: attributes)
+            cell.contentLb.attributedText = NSAttributedString(string: content, attributes: attributes as [NSAttributedString.Key : Any])
             
             cell.contentLb.text = content
             

+ 4 - 7
Koala/Koala/Modular/Information/V/InfomationCell.swift

@@ -13,8 +13,7 @@ class InfomationCell: BaseTableViewCell {
     
     lazy var titleLb: UILabel = {
         let v = UILabel()
-        
-        v.setTextFont(.PFSR, s(14))
+        v.font = .pf_14_regular
         v.numberOfLines = 2
         v.text = ""
         v.isSkeletonable = true
@@ -23,7 +22,6 @@ class InfomationCell: BaseTableViewCell {
     
     lazy var picIv: UIImageView = {
         let v = UIImageView()
-    
         v.contentMode = .scaleAspectFill
         v.clipsToBounds = true
         v.layer.masksToBounds = true
@@ -34,7 +32,7 @@ class InfomationCell: BaseTableViewCell {
     
     lazy var nickNameLb: UILabel = {
         let v = UILabel()
-        v.setTextFont(.PFSR, s(10))
+        v.font = .pf_10_regular
         v.text = ""
         v.isSkeletonable = true
         return v
@@ -42,15 +40,14 @@ class InfomationCell: BaseTableViewCell {
     
     lazy var rateLb: UILabel = {
         let v = UILabel()
-        v.setTextFont(.PFSR, s(10))
+        v.font = .pf_10_regular
         v.text = ""
         return v
     }()
     
     lazy var timeLb: UILabel = {
         let v = UILabel()
-      
-        v.setTextFont(.PFSR, s(10))
+        v.font = .pf_10_regular
         v.text = ""
         return v
     }()

+ 13 - 18
Koala/Koala/Modular/Information/V/InformationDetailCell.swift

@@ -11,9 +11,8 @@ import UIKit
 class InformationDetailCell: BaseTableViewCell {
     lazy var titleLb: UILabel = {
         let v = UILabel()
-        v.textAlignment = .left
-        v.font = _PFSSM(20)
-        v.textColor = _color("#333333&#333333")
+        v.font = .pf_20_semibold
+        v.textColor = Color(0x333333)
         v.numberOfLines = 0
         
         return v
@@ -21,27 +20,24 @@ class InformationDetailCell: BaseTableViewCell {
     
     lazy var originLb: UILabel = {
         let v = UILabel()
-        v.textAlignment = .left
-        v.setTextFont(.PFSR, 14)
-        v.textColor = _color("#878787&#878787")
+        v.font = .pf_14_regular
+        v.textColor = Color(0x878787)
         
         return v
     }()
     
     lazy var timeLb: UILabel = {
         let v = UILabel()
-        v.textAlignment = .left
-        v.setTextFont(.PFSR, 14)
-        v.textColor = _color("#878787&#878787")
+        v.font = .pf_14_regular
+        v.textColor = Color(0x878787)
         
         return v
     }()
     
     lazy var contentLb: UILabel = {
         let v = UILabel()
-        v.textAlignment = .left
-        v.setTextFont(.PFSR, 18)
-        v.textColor = _color("#3d3c3c&#3d3c3c")
+        v.font = .pf_16_regular
+        v.textColor = Color(0x3D3C3C)
         v.numberOfLines = 0
         
         return v
@@ -49,15 +45,14 @@ class InformationDetailCell: BaseTableViewCell {
     
     lazy var lineView: UIView = {
         let v = UIView()
-        v.backgroundColor = _color("#EFEFEF&#EFEFEF")
+        v.backgroundColor = Color(0xEFEFEF)
         return v
     }()
     
     lazy var tipLb: UILabel = {
         let v = UILabel()
-        v.textAlignment = .left
-        v.setTextFont(.PFSR, 12)
-        v.textColor = _color("#9F9F9F&#9F9F9F")
+        v.font = .pf_12_regular
+        v.textColor = Color(0x9F9F9F)
         v.numberOfLines = 0
         v.text = switchLanguage("详情来源")
         return v
@@ -94,9 +89,9 @@ class InformationDetailCell: BaseTableViewCell {
         
         contentView.addSubview(lineView)
         lineView.snp.makeConstraints { make in
-            make.top.equalTo(contentLb.snp.bottom).offset(18)
+            make.top.equalTo(contentLb.snp.bottom).offset(10)
             make.left.right.equalTo(contentLb)
-            make.height.equalTo(1)
+            make.height.equalTo(0.5)
         }
         
         contentView.addSubview(tipLb)

+ 3 - 3
Koala/Koala/Modular/Market/V/MarketDetailView/MDNewsView/MDNewsListCell.swift

@@ -17,11 +17,11 @@ class MDNewsListCell: BaseTableViewCell {
         
         self.backgroundColor = .clear
         
-        self.titleLab.setTextFont(.PFSR, 14)
+        self.titleLab.font = .pf_14_regular
         self.titleLab.textColor = TitleTextColor
         
-        self.timerLab.setTextFont(.PFSR, 12)
-        self.timerLab.textColor = MidTextColor
+        self.timerLab.font = .pf_12_regular
+        self.timerLab.textColor = Color(0xA6A6A6)
     }
 
     override func setSelected(_ selected: Bool, animated: Bool) {

+ 5 - 0
Koala/Koala/Other/FontTheme.swift

@@ -14,6 +14,11 @@ extension UIFont {
     static let pf_20_semibold = UIFont(name: "PingFangSC-Semibold", size: s(20))
     static let pf_20_light = UIFont(name: "PingFangSC-Light", size: s(20))
     static let pf_20_medium = UIFont(name: "PingFangSC-Medium", size: s(20))
+    
+    static let pf_18_regular = UIFont(name: "PingFangSC-Regular", size: s(18))
+    static let pf_18_semibold = UIFont(name: "PingFangSC-Semibold", size: s(18))
+    static let pf_18_light = UIFont(name: "PingFangSC-Light", size: s(18))
+    static let pf_18_medium = UIFont(name: "PingFangSC-Medium", size: s(18))
 
     static let pf_16_regular = UIFont(name: "PingFangSC-Regular", size: s(16))
     static let pf_16_semibold = UIFont(name: "PingFangSC-Semibold", size: s(16))