Browse Source

首页改变布局方式

100Years 1 month ago
parent
commit
8f6d3eb422

+ 12 - 0
AIEmoji.xcodeproj/project.pbxproj

@@ -96,6 +96,7 @@
 		A82D607F2DB7772200596190 /* TSAIExpandImageVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82D607E2DB7771B00596190 /* TSAIExpandImageVM.swift */; };
 		A82D60812DB7A1E600596190 /* activePhoto.gif in Resources */ = {isa = PBXBuildFile; fileRef = A82D60802DB7A1E600596190 /* activePhoto.gif */; };
 		A82D60832DB87D1A00596190 /* TSAIExpandChangeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82D60822DB87D1900596190 /* TSAIExpandChangeView.swift */; };
+		A82D608B2DB9CE7E00596190 /* MXParallaxHeader+Ex.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82D608A2DB9CE7A00596190 /* MXParallaxHeader+Ex.swift */; };
 		A83404C82D9BEC0E00C140E4 /* UIFont+TSEx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A83404C72D9BEC0700C140E4 /* UIFont+TSEx.swift */; };
 		A83404CC2D9BEED800C140E4 /* Poppins-BlackItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A83404CB2D9BEED800C140E4 /* Poppins-BlackItalic.ttf */; };
 		A83404D12D9D16FA00C140E4 /* TSAIPhotoGeneratorBaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A83404D02D9D16F800C140E4 /* TSAIPhotoGeneratorBaseVC.swift */; };
@@ -335,6 +336,7 @@
 		A82D607E2DB7771B00596190 /* TSAIExpandImageVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSAIExpandImageVM.swift; sourceTree = "<group>"; };
 		A82D60802DB7A1E600596190 /* activePhoto.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = activePhoto.gif; sourceTree = "<group>"; };
 		A82D60822DB87D1900596190 /* TSAIExpandChangeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSAIExpandChangeView.swift; sourceTree = "<group>"; };
+		A82D608A2DB9CE7A00596190 /* MXParallaxHeader+Ex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MXParallaxHeader+Ex.swift"; sourceTree = "<group>"; };
 		A83404C72D9BEC0700C140E4 /* UIFont+TSEx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+TSEx.swift"; sourceTree = "<group>"; };
 		A83404CB2D9BEED800C140E4 /* Poppins-BlackItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Poppins-BlackItalic.ttf"; sourceTree = "<group>"; };
 		A83404D02D9D16F800C140E4 /* TSAIPhotoGeneratorBaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSAIPhotoGeneratorBaseVC.swift; sourceTree = "<group>"; };
@@ -1110,6 +1112,14 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		A82D60892DB9CE7300596190 /* MXParallaxHeader */ = {
+			isa = PBXGroup;
+			children = (
+				A82D608A2DB9CE7A00596190 /* MXParallaxHeader+Ex.swift */,
+			);
+			path = MXParallaxHeader;
+			sourceTree = "<group>";
+		};
 		A83404C62D9BEC0300C140E4 /* Ex */ = {
 			isa = PBXGroup;
 			children = (
@@ -1550,6 +1560,7 @@
 		A8F774C62D38EA8C00AA6E93 /* ThirdParty */ = {
 			isa = PBXGroup;
 			children = (
+				A82D60892DB9CE7300596190 /* MXParallaxHeader */,
 				A80EDD452D6C3F82003CD332 /* MarkdownKit */,
 			);
 			path = ThirdParty;
@@ -2161,6 +2172,7 @@
 				A80E722F2D3F3E1400C64288 /* TSDiyCanvasView.swift in Sources */,
 				A8F4134E2DA75E9E001E715A /* TSAboutDataVC.swift in Sources */,
 				A80E72672D409C7D00C64288 /* Template+More.swift in Sources */,
+				A82D608B2DB9CE7E00596190 /* MXParallaxHeader+Ex.swift in Sources */,
 				A89EA6AC2D5B3EFB000EB181 /* TSRealmManager.swift in Sources */,
 				A8BA76772DA68619000B6707 /* TSAIListHistoryBaseVM.swift in Sources */,
 				A80EDDE42D6EB8FA003CD332 /* TSPTPSelectStyleCell.swift in Sources */,

+ 0 - 3
AIEmoji/Business/TSAILIstVC/TSAIExpandImageVC/TSAIExpandImageVC.swift

@@ -128,9 +128,6 @@ extension TSAIExpandImageVC {
         if let image = image {
             upLoadImage = image
             viewModel.upLoadImage = image
-            //选中后,去到 1:1
-//            styleView.currentIndexPath = IndexPath(item: 1, section: 0)
-//            viewModel.selectStyleModel = viewModel.selectStyleModels.safeObj(At: 1)
             updateExpandArea()
         }
         

+ 1 - 1
AIEmoji/Business/TSAILIstVC/TSAIUploadPhotoBaseVC/TSAIUploadPhotoBaseVC.swift

@@ -200,7 +200,7 @@ extension TSAIUploadPhotoBaseVC {
         
         //文字信息区域
         cusStackView.addSubviewToStack(getTextInfoCell(text: "Single photo with face fully visible".localized))
-        cusStackView.addSpacing(height: lineSpacing)
+        cusStackView.addSpacing(length: lineSpacing)
         cusStackView.addSubviewToStack(getTextInfoCell(text: "No group photos, covered faces, nudes".localized))
     }
     

+ 64 - 127
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/TSPTPInputVC.swift

@@ -5,9 +5,7 @@
 //  Created by 100Years on 2025/4/7.
 //
 
-//import IQKeyboardManagerSwift
 import PhotosUI
-import MXParallaxHeader
 class TSPTPInputVC: TSBaseVC {
 
     lazy var viewModel: TSPTPInputVM = {
@@ -61,7 +59,7 @@ class TSPTPInputVC: TSBaseVC {
     //###################################### cusStackView ######################################
     lazy var cusStackView: TSCustomStackView = {
         let cusStackView = TSCustomStackView(axis: .vertical,spacing: 0)
-        cusStackView.scrollView.isScrollEnabled = false
+        cusStackView.scrollView.isScrollEnabled = true
         return cusStackView
     }()
 
@@ -88,7 +86,6 @@ class TSPTPInputVC: TSBaseVC {
     
     
     func pickSinglePhoto()  {
-//        photoPickerManager.pickSinglePhoto(maxBitSize: kUploadImageMaxBit10Size) { [weak self] image, errorString in
         photoPickerManager.pickCustomSinglePhoto() { [weak self] image, errorString in
             guard let self = self else { return }
             if let errorString = errorString {
@@ -179,13 +176,14 @@ class TSPTPInputVC: TSBaseVC {
         return promptTextView
     }()
     //###################################### 集合视图 ######################################
+    private var collectionViewObserver: CollectionViewObserver!
     let collectionViewBtootm:CGFloat = 80
     lazy var collectionComponent: TSCollectionViewComponent = {
         let layout = UICollectionViewFlowLayout()
         let cp = TSCollectionViewComponent(frame: CGRect.zero, layout: layout, attributes: [:])
         cp.collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: collectionViewBtootm, right: 0)
-        
-        
+        cp.collectionView.isScrollEnabled = false
+ 
         // 禁用自动 contentInset 调整
           if #available(iOS 11.0, *) {
               cp.collectionView.contentInsetAdjustmentBehavior = .never
@@ -233,25 +231,24 @@ class TSPTPInputVC: TSBaseVC {
         submitBtn.isEnabled = false
         return submitBtn
     }()
+    
+    
     override func createView() {
         
+        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(clickView))
+        tapGesture.cancelsTouchesInView = false
+        view.addGestureRecognizer(tapGesture)
+        
         navBarContentView.addSubview(navBarView)
         navBarView.snp.makeConstraints { make in
             make.edges.equalToSuperview()
         }
-
-        contentView.addSubview(collectionComponent.collectionView)
-        collectionComponent.collectionView.snp.makeConstraints { make in
+        
+        contentView.addSubview(cusStackView)
+        cusStackView.snp.makeConstraints { make in
             make.edges.equalToSuperview()
         }
-        
-        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(clickView))
-        tapGesture.cancelsTouchesInView = false
-        view.addGestureRecognizer(tapGesture)
 
-        collectionComponent.clear()
-        collectionComponent.reloadView(with:viewModel.colDataArray)
-        
         contentView.addSubview(submitBtn)
         submitBtn.snp.makeConstraints { make in
             make.bottom.equalTo(-16)
@@ -261,21 +258,15 @@ class TSPTPInputVC: TSBaseVC {
         }
         
         setUpCusStackView()
-        
-        setHeaderCusStackView()
-        kDelayMainShort {
-            self.setHeaderCusStackView()
-        }
     }
     
-    func setHeaderCusStackView(){
-        self.collectionComponent.collectionView.parallaxHeader.view = self.cusStackView
-        self.collectionComponent.collectionView.parallaxHeader.height = self.cusStackViewH
-        self.collectionComponent.collectionView.parallaxHeader.mode = .bottom
-        self.collectionComponent.collectionView.parallaxHeader.minimumHeight = 0
-    }
+
     
     override func dealThings() {
+        
+        collectionComponent.clear()
+        collectionComponent.reloadView(with:viewModel.colDataArray)
+        
         NotificationCenter.default.addObserver(self, selector: #selector(vipInfoChanged), name: .kPurchaseDidChanged, object: nil)
         updateVipView()
         TSAIListHintBaseVC.userDefaultsKey = "isFirstUploadImagePTP"
@@ -284,48 +275,26 @@ class TSPTPInputVC: TSBaseVC {
         NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
         
-        //        collectionViewObserverHandle()
-    }
-
-
-//    private var collectionViewObserver: CollectionViewObserver!
-//    func collectionViewObserverHandle(){
-//        collectionViewObserver = CollectionViewObserver(collectionView: collectionComponent.collectionView)
-//        
-//        collectionViewObserver.onContentSizeChange = { size in
-//            print("collectionViewObserver 内容大小变化: \(size)")
-//        }
-//        
-//        collectionViewObserver.onContentInsetChange = { inset in
-//            print("collectionViewObserver 内边距变化: \(inset)")
-//        }
-//        
-//        collectionViewObserver.onContentOffsetChange = { offset in
-//            print("collectionViewObserver 偏移量变化: \(offset)")
+//        kDelayMainShort {
+//            let contentSize = self.collectionComponent.collectionView.collectionViewLayout.collectionViewContentSize
+//            self.collectionComponent.collectionView.snp.updateConstraints { make in
+//               make.height.equalTo(contentSize.height)
+//            }
 //        }
-//        
-//    }
-//    
-//    
-//    func scrollViewDidScroll(_ scrollView: UIScrollView) {
-//        print("contentOffset 变化: \(scrollView.contentOffset)")
-//        // 实时监听偏移量变化
-//    }
-}
-
-extension TSPTPInputVC {
-    
-    var cusStackViewH:CGFloat{
-        get {
-            if cusStackView.viewH > 0{
-                dePrint("collectionViewObserver cusStackView.viewH == \(cusStackView.viewH)")
-                return cusStackView.viewH
+        
+        collectionViewObserver = CollectionViewObserver(collectionView: collectionComponent.collectionView)
+        collectionViewObserver.onContentSizeChange = {[weak self]  size in
+            guard let self = self else { return }
+            print("collectionViewObserver 内容大小变化: \(size)")
+            self.collectionComponent.collectionView.snp.updateConstraints { make in
+               make.height.equalTo(size.height)
             }
-            return 454
         }
     }
-    
+}
 
+extension TSPTPInputVC {
+    
     func presentModalHintVC(){
         hintBaseVC = TSAIListHintBaseVC(config: .defaultConfig) { [weak self] image in
             guard let self = self else { return }
@@ -380,15 +349,16 @@ extension TSPTPInputVC {
         
         promptTextView.isHidden = !viewModel.selectedPTPStyleModel.input
 
-    }
-    
-    override func viewDidLayoutSubviews() {
-        super.viewDidLayoutSubviews()
+        cusStackView.addSubviewToStack(collectionComponent.collectionView)
+        collectionComponent.collectionView.snp.makeConstraints { make in
+            make.height.equalTo(0)
+            make.width.equalTo(k_ScreenWidth)
+        }
+        
+        cusStackView.addSpacing(length: collectionViewBtootm)
     }
 }
 
-
-
 extension TSPTPInputVC: UITextViewDelegate{
     // 实现 UITextViewDelegate 协议方法,控制 return 键行为
     func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
@@ -473,75 +443,42 @@ extension TSPTPInputVC {
 }
 
 extension TSPTPInputVC {
-    // MARK: - 键盘弹出时滚动到 TextView
-     @objc func keyboardWillShow(_ notification: Notification) {
-         guard let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else { return }
-         let textView = customTextView
-         guard let scrollView = collectionComponent.collectionView else { return }
-         // 1. 计算键盘高度(减去安全区域)
-         let keyboardHeight = keyboardFrame.height - view.safeAreaInsets.bottom
-         dePrint("keyboardHeight = \(keyboardHeight )")
-         // 2. 直接获取 TextView 在 ScrollView 中的位置
-         let textViewFrame = scrollView.convert(textView.frame, from: textView.superview)
-         dePrint("textViewFrame = \(textViewFrame)")
-         // 3. 计算需要滚动的距离(TextView 底部 - (屏幕高度 - 键盘高度))
-         var scrollDistance = textViewFrame.maxY - (scrollView.bounds.height - keyboardHeight)
-         dePrint("scrollDistance = \(scrollDistance)")
-         // 4. 如果需要滚动,调整 contentOffset
-         var y = scrollDistance
-         scrollView.setContentOffset(CGPoint(x: 0, y: y),animated: true)
-     }
+    @objc func keyboardWillShow(_ notification: Notification) {
+        guard let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else { return }
+        let textView = customTextView
+//        guard let scrollView = cusStackView.scrollView else { return }
+        let scrollView = cusStackView.scrollView
+        // 1. 计算键盘高度(减去安全区域)
+        let keyboardHeight = keyboardFrame.height - view.safeAreaInsets.bottom
+//        dePrint("keyboardHeight = \(keyboardHeight )")
+        // 2. 直接获取 TextView 在 ScrollView 中的位置
+        let textViewFrame = scrollView.convert(textView.frame, from: textView.superview)
+//        dePrint("textViewFrame = \(textViewFrame)")
+        // 3. 计算需要滚动的距离(TextView 底部 - (屏幕高度 - 键盘高度))
+        var scrollDistance = textViewFrame.maxY - (scrollView.bounds.height - keyboardHeight)
+//        dePrint("scrollDistance = \(scrollDistance)")
+        // 4. 如果需要滚动,调整 contentOffset
+        var y = scrollDistance
+        scrollView.setContentOffset(CGPoint(x: 0, y: y),animated: true)
+    }
     
     // MARK: - 键盘隐藏时恢复
     @objc private func keyboardWillHide(_ notification: Notification) {
-        self.collectionComponent.collectionView.contentOffset = CGPoint(x: 0, y: -cusStackViewH)
+        cusStackView.scrollView.contentOffset = CGPoint(x: 0, y: 0)
     }
 }
 extension TSPTPInputVC {
     
     func updateTextFiledView () {
         if viewModel.selectedPTPStyleModel.input {
-            cusStackView.showWithDrawerAnimation(view: promptTextView, viewHeight: promptTextViewH) { [weak self]  in
-                self?.updateViewCusStackViewH()
-            }
+            promptTextView.isHidden = false
         }else{
-            cusStackView.hideWithDrawerAnimation(view: promptTextView, viewHeight: promptTextViewH) { [weak self]  in
-                self?.updateViewCusStackViewH()
-            }
+            promptTextView.isHidden = true
         }
-    }
-    
-    func updateViewCusStackViewH() {
-        
-        self.collectionComponent.collectionView.parallaxHeader.updateHeaderHeight(height: self.cusStackViewH)
         
-//        self.collectionComponent.collectionView.parallaxHeader.height = self.cusStackViewH
-//   
-//        let newHeight = self.cusStackViewH
-//        let headerView = self.collectionComponent.collectionView.parallaxHeader.view!
-//        for constraint in headerView.constraints {
-//            if constraint.firstAttribute == .height &&
-//               constraint.firstItem as? UIView == headerView &&
-//               constraint.secondItem == nil {
-//                constraint.constant = newHeight
-//                break
-//            }
-//        }
-    }
-
-}
-
-extension MXParallaxHeader {
-    func updateHeaderHeight(height:CGFloat){
-        self.height = height
-        let headerView = view!
-        for constraint in headerView.constraints {
-            if constraint.firstAttribute == .height &&
-               constraint.firstItem as? UIView == headerView &&
-               constraint.secondItem == nil {
-                constraint.constant = height
-                break
-            }
+        UIView.animate(withDuration: 0.3) {
+            self.cusStackView.layoutIfNeeded()
         }
     }
 }
+

+ 28 - 0
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/VM/CollectionViewObserver.swift

@@ -47,3 +47,31 @@ class CollectionViewObserver {
         observers.forEach { $0.invalidate() }
     }
 }
+
+
+
+//        collectionViewObserverHandle()
+//
+//private var collectionViewObserver: CollectionViewObserver!
+//func collectionViewObserverHandle(){
+//    collectionViewObserver = CollectionViewObserver(collectionView: collectionComponent.collectionView)
+//    
+//    collectionViewObserver.onContentSizeChange = { size in
+//        print("collectionViewObserver 内容大小变化: \(size)")
+//    }
+//    
+//    collectionViewObserver.onContentInsetChange = { inset in
+//        print("collectionViewObserver 内边距变化: \(inset)")
+//    }
+//    
+//    collectionViewObserver.onContentOffsetChange = { offset in
+//        print("collectionViewObserver 偏移量变化: \(offset)")
+//    }
+//    
+//}
+//
+//
+//func scrollViewDidScroll(_ scrollView: UIScrollView) {
+//    print("contentOffset 变化: \(scrollView.contentOffset)")
+//    // 实时监听偏移量变化
+//}

+ 7 - 7
AIEmoji/Business/TSPTPGeneratorVC/TSUploadPhotoPrivacyAlertVC/TSUploadPhotoPrivacyAlertVC.swift

@@ -73,9 +73,9 @@ class TSUploadPhotoPrivacyAlertVC: TSBaseVC {
     let lineSpacing = 6.0
     func setUpUI(){
         
-        cusStackView.addSpacing(height: 28+k_Height_StatusBar)
+        cusStackView.addSpacing(length: 28+k_Height_StatusBar)
         cusStackView.addSubviewToStack(topImageTtileView)
-        cusStackView.addSpacing(height: 23)
+        cusStackView.addSpacing(length: 23)
         
         let textLabel = UILabel.createLabel(text: "We need your consent to use this feature:".localized,font: .font(size: 16),textColor: .white,numberOfLines: 0)
         textLabel.setLineSpacing(8)
@@ -84,24 +84,24 @@ class TSUploadPhotoPrivacyAlertVC: TSBaseVC {
             make.leading.equalTo(16)
             make.trailing.equalTo(-35)
         }
-        cusStackView.addSpacing(height: 16)
+        cusStackView.addSpacing(length: 16)
         addTextInfo()
-        cusStackView.addSpacing(height: 16)
+        cusStackView.addSpacing(length: 16)
         addTextPrivacy()
     }
 
     func addTextInfo(){
         cusStackView.addSubviewToStack(getTextInfoCell(text: "This App is photo or video editors that allow you to edit portraits with highly realistic facial transformations. We do not use photos or videos you provide when you use the Apps for any reason other than to provide you with the editing functionality of the Apps.".localized))
         
-        cusStackView.addSpacing(height: lineSpacing)
+        cusStackView.addSpacing(length: lineSpacing)
         
         cusStackView.addSubviewToStack(getTextInfoCell(text: "Every photo you select for editing will be encrypted and temporarily cached on cloud servers for image processing and face transformation.".localized))
         
-        cusStackView.addSpacing(height: lineSpacing)
+        cusStackView.addSpacing(length: lineSpacing)
         
         cusStackView.addSubviewToStack(getTextInfoCell(text: "We use third-party cloud providers - Amazon Web Services - to process and edit photos and videos.".localized))
         
-        cusStackView.addSpacing(height: lineSpacing)
+        cusStackView.addSpacing(length: lineSpacing)
         
         cusStackView.addSubviewToStack(getTextInfoCell(text: "Photos or videos only remain in the cloud for a maximum limited period of 24 to 48 hours, for improved performance and lower bandwidth allowing additional changes to recently selected photos or videos in an optimal manner.".localized))
     }

+ 5 - 5
AIEmoji/Business/TSSetingVC/TSAboutDataVC.swift

@@ -30,24 +30,24 @@ class TSAboutDataVC: TSBaseVC {
     let lineSpacing = 6.0
     func setUpUI(){
         
-        cusStackView.addSpacing(height: 20)
+        cusStackView.addSpacing(length: 20)
         addTextInfo()
-        cusStackView.addSpacing(height: 16)
+        cusStackView.addSpacing(length: 16)
         addTextPrivacy()
     }
 
     func addTextInfo(){
         cusStackView.addSubviewToStack(getTextInfoCell(text: "This App is photo or video editors that allow you to edit portraits with highly realistic facial transformations. We do not use photos or videos you provide when you use the Apps for any reason other than to provide you with the editing functionality of the Apps.".localized))
         
-        cusStackView.addSpacing(height: lineSpacing)
+        cusStackView.addSpacing(length: lineSpacing)
         
         cusStackView.addSubviewToStack(getTextInfoCell(text: "Every photo you select for editing will be encrypted and temporarily cached on cloud servers for image processing and face transformation.".localized))
         
-        cusStackView.addSpacing(height: lineSpacing)
+        cusStackView.addSpacing(length: lineSpacing)
         
         cusStackView.addSubviewToStack(getTextInfoCell(text: "We use third-party cloud providers - Amazon Web Services - to process and edit photos and videos.".localized))
         
-        cusStackView.addSpacing(height: lineSpacing)
+        cusStackView.addSpacing(length: lineSpacing)
         
         cusStackView.addSubviewToStack(getTextInfoCell(text: "Photos or videos only remain in the cloud for a maximum limited period of 24 to 48 hours, for improved performance and lower bandwidth allowing additional changes to recently selected photos or videos in an optimal manner.".localized))
     }

+ 21 - 0
AIEmoji/Common/ThirdParty/MXParallaxHeader/MXParallaxHeader+Ex.swift

@@ -0,0 +1,21 @@
+//
+//  MXParallaxHeader+Ex.swift
+//  AIEmoji
+//
+//  Created by 100Years on 2025/4/23.
+//
+import MXParallaxHeader
+extension MXParallaxHeader {
+    func updateHeaderHeight(height:CGFloat){
+        self.height = height
+        let headerView = view!
+        for constraint in headerView.constraints {
+            if constraint.firstAttribute == .height &&
+               constraint.firstItem as? UIView == headerView &&
+               constraint.secondItem == nil {
+                constraint.constant = height
+                break
+            }
+        }
+    }
+}