Procházet zdrojové kódy

修改分享title collection frame

huzhiqiang před 3 roky
rodič
revize
49ba0d848a

+ 12 - 11
BFFramework/Classes/Stuckpoint/View/PQEditPublicTitleView.swift

@@ -118,10 +118,10 @@ class PQEditPublicTitleView: UIView {
         backView.addSubview(titleCollectionView)
 
         backView.snp.makeConstraints { make in
-            make.right.equalToSuperview()
-            make.width.equalTo(cScreenWidth)
-            make.height.equalTo(640)
-            make.bottom.equalToSuperview()
+            make.edges.equalToSuperview()
+//            make.width.equalTo(cScreenWidth)
+//            make.height.equalTo(min(640, cScreenHeigth))
+//            make.bottom.equalToSuperview()
         }
 
         closeView.snp.makeConstraints { make in
@@ -133,7 +133,7 @@ class PQEditPublicTitleView: UIView {
 
         inputBgView.snp.makeConstraints { make in
             make.left.equalToSuperview().offset(16)
-            make.width.equalTo(343)
+            make.width.equalTo(min(343, cScreenWidth-32))
             make.height.equalTo(68)
             make.top.equalToSuperview().offset(20)
         }
@@ -153,10 +153,11 @@ class PQEditPublicTitleView: UIView {
         }
 
         titleCollectionView.snp.makeConstraints { make in
-            make.right.equalToSuperview()
-            make.width.equalTo(cScreenWidth)
-            make.height.equalTo(542 - cAKSafeAreaHeight)
             make.top.equalTo(inputBgView.snp_bottom).offset(10)
+            make.width.right.equalToSuperview()
+            make.bottom.equalTo(0 - cAKSafeAreaHeight)
+//            make.width.equalTo(cScreenWidth)
+//            make.height.equalTo(542 - cAKSafeAreaHeight)
         }
  
         titleCollectionView.reloadData()
@@ -194,12 +195,12 @@ class PQEditPublicTitleView: UIView {
 
 extension PQEditPublicTitleView: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate {
     func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int {
-        return titles.count
+        return 1;//titles.count
     }
 
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: PQEditPublicTitleViewContentCell.self), for: indexPath) as! PQEditPublicTitleViewContentCell
-        cell.titleStr = titles[indexPath.row]
+        cell.titleStr = "aaaa";//titles[indexPath.row]
         return cell
     }
 
@@ -209,7 +210,7 @@ extension PQEditPublicTitleView: UICollectionViewDelegate, UICollectionViewDataS
     }
 
     func collectionView(_ collectionView: UICollectionView, layout _: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
-        let title = titles[indexPath.row]
+        let title = "aaa";//titles[indexPath.row]
  
         let textSize =  sizeWithText(text: title, font: UIFont.systemFont(ofSize: 17, weight: .regular), size: CGSize.init(width: 295, height: CGFloat.greatestFiniteMagnitude))