Browse Source

音乐厅曲目顺序调整 推荐、热门、最新

Steven 2 months ago
parent
commit
897a8eb892

+ 29 - 23
KulexiuForStudent/KulexiuForStudent/Module/MusicSquare/Controller/MusicSquareViewController.m

@@ -101,24 +101,26 @@
         make.height.mas_equalTo(self.recommendMusicViewHeight);
     }];
     
-    // 最新曲目
-    [self.scrollView addSubview:self.newestMusicView];
-    self.newestMusicViewHeight = [HomeNewMusicView getViewHeight];
-    [self.newestMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.view);
-        make.top.mas_equalTo(self.recommendMusicView.mas_bottom);
-        make.height.mas_equalTo(self.newestMusicViewHeight);
-    }];
-    
     // 热门曲目
     [self.scrollView addSubview:self.hotMusicView];
     self.musicViewHeight = [HomeHotMusicView getViewHeight];
     [self.hotMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.right.mas_equalTo(self.view);
-        make.top.mas_equalTo(self.newestMusicView.mas_bottom);
+        make.top.mas_equalTo(self.recommendMusicView.mas_bottom);
         make.height.mas_equalTo(self.musicViewHeight);
+    }];
+    
+    // 最新曲目
+    [self.scrollView addSubview:self.newestMusicView];
+    self.newestMusicViewHeight = [HomeNewMusicView getViewHeight];
+    [self.newestMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.right.mas_equalTo(self.view);
+        make.top.mas_equalTo(self.hotMusicView.mas_bottom);
+        make.height.mas_equalTo(self.newestMusicViewHeight);
         make.bottom.mas_equalTo(self.scrollView.mas_bottom).offset(-10);
     }];
+    
+    
     MJWeakSelf;
     self.scrollView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
         [weakSelf requestData];
@@ -220,6 +222,7 @@
 }
 
 - (void)refreshMusicView {
+    // 推荐
     if (self.recommendMusicArray.count) {
         self.recommendMusicViewHeight = [HomeHotMusicView getViewHeight];
         self.recommendMusicView.hidden = NO;
@@ -234,6 +237,22 @@
     }];
     [self.recommendMusicCollectionView reloadData];
     
+    // 热门
+    if (self.musicArray.count) {
+        self.musicViewHeight = [HomeHotMusicView getViewHeight];
+        self.hotMusicView.hidden = NO;
+    }
+    else {
+        self.musicViewHeight = CGFLOAT_MIN;
+        self.hotMusicView.hidden = YES;
+    }
+    
+    [self.hotMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(self.musicViewHeight);
+    }];
+    [self.musicCollectionView reloadData];
+    
+    // 最新
     if (self.newestMusicArray.count) {
         self.newestMusicViewHeight = [HomeHotMusicView getViewHeight];
         self.newestMusicView.hidden = NO;
@@ -247,19 +266,6 @@
         make.height.mas_equalTo(self.newestMusicViewHeight);
     }];
     [self.newestMusicCollectionView reloadData];
-    
-    if (self.musicArray.count) {
-        self.musicViewHeight = [HomeHotMusicView getViewHeight];
-        self.hotMusicView.hidden = NO;
-    }
-    else {
-        self.musicViewHeight = CGFLOAT_MIN;
-        self.hotMusicView.hidden = YES;
-    }
-    [self.hotMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
-        make.height.mas_equalTo(self.musicViewHeight);
-    }];
-    [self.musicCollectionView reloadData];
 }