Sfoglia il codice sorgente

【首页】高级工具列表,子模块数量较少时,页码指示器显示错误 -- 优化

lizhe 11 mesi fa
parent
commit
a824db97f3

+ 16 - 1
PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/KMQucikToolsView.swift

@@ -176,7 +176,22 @@ extension KMQucikToolsView: NSCollectionViewDelegateFlowLayout {
 //Collection Page
 extension KMQucikToolsView {
     func pageCount() -> Int {
-        return Int(ceilf(Float(self.collectionView.frame.size.width / self.collectionView.visibleRect.size.width)))
+        print(self.collectionView.frame.size)
+        print(self.collectionView.visibleRect.size)
+        
+        var width =  260.0
+        var count = ceilf(Float(self.data.count) * 0.5)
+        if type == .collapse {
+            width = 170
+        } else if type == .expand {
+            width = 260
+        } else {
+            width = 260
+        }
+        width = Double(count) * (width + 10)
+        
+        return Int(ceilf(Float(width / self.collectionView.visibleRect.size.width)))
+//        return Int(ceilf(Float(self.collectionView.frame.size.width / self.collectionView.visibleRect.size.width)))
     }
     
     func currentPage() -> Int {