Prechádzať zdrojové kódy

20个素材后隐藏 + 号按钮

harry 3 rokov pred
rodič
commit
2fb3e4facb
1 zmenil súbory, kde vykonal 14 pridanie a 2 odobranie
  1. 14 2
      Introduce/Record/INIntroduceController.swift

+ 14 - 2
Introduce/Record/INIntroduceController.swift

@@ -106,7 +106,7 @@ class INIntroduceController: BFBaseViewController {
         stripSwithView.snp.makeConstraints { make in
             make.left.equalTo(backButton!.snp.right).offset(5)
             make.top.height.equalTo(backButton!)
-            if assets!.count > 1 {
+            if (assets?.count ?? 0) > 1 {
                 make.width.equalTo(cScreenWidth).priority(.high)
             }else{
                 make.width.equalTo(0).priority(.high)
@@ -115,7 +115,11 @@ class INIntroduceController: BFBaseViewController {
         addMaterialBtn.snp.makeConstraints { make in
             make.left.equalTo(stripSwithView.snp.right).offset(-2)
             make.top.height.equalTo(backButton!)
-            make.width.equalTo(addMaterialBtn.snp.height)
+            if (assets?.count ?? 0) < 20 {
+                make.width.equalTo(addMaterialBtn.snp.height)
+            }else {
+                make.width.equalTo(0)
+            }
             make.right.lessThanOrEqualTo(exportBtn.snp.left).offset(-15)
         }
         
@@ -139,6 +143,14 @@ class INIntroduceController: BFBaseViewController {
     // MARK: - Button action
     func updateAsset(_ phAssets:[PHAsset]) {
         recordScreenVC.fetchMaterial(phAssets)
+        if recordScreenVC.itemModels.count >= 20 {
+            addMaterialBtn.snp.remakeConstraints { make in
+                make.left.equalTo(stripSwithView.snp.right).offset(-2)
+                make.top.height.equalTo(backButton!)
+                make.width.equalTo(0)
+                make.right.lessThanOrEqualTo(exportBtn.snp.left).offset(-15)
+            }
+        }
         resetStripSwithView(recordScreenVC.itemModels.count)
     }