如何使用swift 3使UICollectionview中的最后一行变为粘性

问题描述 投票:1回答:1

我在UICollectionView中使用带有自定义流布局的多向滚动来创建数字表。

表的结构应该是这样的。一个数字表,其中包含最后一行的总和值:

现在表的第一列和第一行是静态的,即粘性的。我希望最后一行也可以粘贴在视图的底部。请帮助我。

这是我目前对该表的看法:

先感谢您。

swift3 uicollectionview
1个回答
1
投票
if section == sectionCount-1 {

    for item in 0...rowCount-1 {
         let indexPath = IndexPath(item: item, section: section)                                
         if let attrs = cellAttrsDictionary[indexPath] {
              var frame = attrs.frame            
              if item == 0 {                 
                  // Assigning the size of the first column as 200
                  frame.size.width = 200
                  frame.origin.x = xOffset
              }

              // Configuration for the last row in the last cell.

              // Subtracting the Cell height from the entire Collection View height and assigning it as the frame for the last row of the Table i.e precisely on Y position.

              frame.origin.y = (collectionView?.frame.size.height)! + yOffset - CGFloat(CELL_HEIGHT)
              attrs.frame = frame
         }                 
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.