测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可协议 | BSD |
发布上次发布 | 2017年2月 |
SwiftSwift版本 | 3.0 |
SPM支持SPM | ✓ |
由Benoit BRIATTE维护。
布局,允许您用极少的代码即可在网格中显示数据系列。它可以具有 UITableView
或 UICollectionView
的外观。
以下说明将帮助您在本地的计算机上部署项目副本,以便开发和测试。有关如何在实际系统上部署项目的说明,请参阅部署。
适用于 iOS 8+,已在 Xcode 8.2 上测试
要使用 cocoapods 安装 DGCollectionGridViewLayout
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'YourTarget' do
frameworks
use_frameworks!
# Pods for YourTarget
pod 'DGCollectionViewGridLayout'
end
pod install
命令安装依赖。 let layout = DGCollectionViewGridLayout()
您可以通过启用一些选项来自定义组件
layout.lineSpacing = 10
layout.columnSpacing = 10
layout.sectionInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
要通过与布局通信,使用与 UICollectionViewFlowLayout
相同的方式。声明您的组件为 DGCollectionViewGridLayoutDelegate
和 DGCollectionViewGridLayoutDataSource
,分别继承自 UICollectionViewDelegate
和 UICollectionViewDataSource
。只需将其分配给您的 collectionView
即可。
self.collectionView.delegate = self
self.collectionView.dataSource = self
/**
Gives the height of an item at an IndexPath. The highest item in the row will set the
height of the row. Default is 100.
**/
@objc optional func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: DGCollectionViewGridLayout,
heightForItemAt indexPath: IndexPath,
columnWidth: CGFloat) -> CGFloat
/**
Gives the height of a ReusableView of Type Header. If no height is provided,
no header will be displayed.
**/
@objc optional func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: DGCollectionViewGridLayout,
heightForHeaderIn section: Int) -> CGFloat
/**
Gives the height of a ReusableView of Type Footer. If no height is provided,
no footer will be displayed.
**/
@objc optional func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: DGCollectionViewGridLayout,
heightForFooterIn section: Int) -> CGFloat
/**
Gives the same width for each items depending on the value returned. Default is 1.
**/
@objc optional func numberOfColumns(in collectionView: UICollectionView) -> Int
当前的限制主要有
Fastlane Fastlane 是一款用于 iOS、Mac 和 Android 开发者以自动处理繁琐任务的工具,例如生成截图、处理配置文件和发布应用。
有关更多详情,请参阅 CONTRIBUTING.md!
此项目遵守 贡献者公约行为准则。通过参与,您将期待信守此准则。如有不适当行为,请向 [email protected] 报告。
DGCollectionGridViewLayout 采用 BSD 3-clause 许可证。