Browse Source

1.首页UI适配

wenweiwei 4 years ago
parent
commit
16788b9277

+ 20 - 24
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Controllers/MVHomeController.swift

@@ -55,7 +55,7 @@ class MVHomeController: MVBaseController {
         flowLayout.minimumLineSpacing = 0
         flowLayout.minimumInteritemSpacing = 10
         flowLayout.scrollDirection = .horizontal
-        let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 35), collectionViewLayout: flowLayout)
+        let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 45), collectionViewLayout: flowLayout)
         collectionView.showsVerticalScrollIndicator = false
         collectionView.showsHorizontalScrollIndicator = false
         collectionView.delegate = self
@@ -118,7 +118,7 @@ class MVHomeController: MVBaseController {
         super.viewWillDisappear(animated)
         controlPlayrPasueOrResume(isPause: true)
     }
-    
+
     func getData() {
         if mVideos.count > 0 {
             BFLog(message: "已经请求过数据")
@@ -222,32 +222,29 @@ class MVHomeController: MVBaseController {
 //            make.left.equalToSuperview().offset(16)
 //            make.bottom.equalToSuperview().offset(-50)
 //        }
+        categoryCollectionView.snp.remakeConstraints { make in
+            make.width.equalTo(cScreenWidth)
+            make.height.equalTo(45)
+            make.left.equalToSuperview().offset(0)
+            make.top.equalToSuperview().offset(cDevice_iPhoneStatusBarHei)
+        }
+
         stuckPointBtn.snp.remakeConstraints { make in
-            make.width.equalTo(60)
-            make.height.equalTo(60)
+            make.width.height.equalTo(60)
             make.centerX.equalToSuperview()
-            make.bottom.equalToSuperview().offset(-50)
+            make.bottom.equalToSuperview().offset(-(cDefaultMargin * 2 + cSafeAreaHeight))
         }
 
         settingBtn.snp.remakeConstraints { make in
-            make.width.equalTo(60)
-            make.height.equalTo(60)
-            make.right.equalToSuperview().offset(-16)
-            make.bottom.equalToSuperview().offset(-50)
+            make.width.height.equalTo(60)
+            make.right.equalToSuperview().offset(-cDefaultMargin * 3)
+            make.centerY.equalTo(stuckPointBtn)
         }
 
         viewListView.snp.remakeConstraints { make in
-            make.width.equalTo(cScreenWidth)
-            make.height.equalTo(cScreenHeigth - 120 - categoryCollectionView.frame.maxY - 24 - 24 - cSafeAreaHeight)
-            make.left.equalToSuperview().offset(0)
-            make.bottom.equalToSuperview().offset(-136)
-        }
-
-        categoryCollectionView.snp.remakeConstraints { make in
-            make.width.equalTo(cScreenWidth)
-            make.height.equalTo(35)
-            make.left.equalToSuperview().offset(0)
-            make.top.equalToSuperview().offset(cDevice_iPhoneStatusBarHei)
+            make.left.right.equalToSuperview()
+            make.top.equalTo(categoryCollectionView.snp_bottom).offset(cDefaultMargin)
+            make.bottom.equalTo(stuckPointBtn.snp_top).offset(-cDefaultMargin * 2)
         }
     }
 
@@ -362,11 +359,10 @@ class MVHomeController: MVBaseController {
             self?.controlPlayrPasueOrResume(isPause: false)
         }
     }
-    
-    
+
     /// 获取用户状态信息
     /// - Returns: <#description#>
-    func getUserInfo() -> Void {
+    func getUserInfo() {
         PQMineViewModel.userStatus { _, _ in
         }
     }
@@ -480,7 +476,7 @@ extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource
         let itemData: MVHotVideoModel = mVideos[indexPath.item]
         let width: CGFloat = CGFloat(CGFloat(itemData.categoryName.ga_widthForComment(font: UIFont.boldSystemFont(ofSize: 17), height: 17.0)) + 36.0 + 20.0)
 
-        return CGSize(width: width, height: collectionView.frame.height)
+        return CGSize(width: width, height: collectionView.frame.height - cDefaultMargin)
     }
 
     func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath) {