ScrollViewLayout
使用简单 API 自定义 UIScrollView
's 子视图的布局。
安装
最低部署目标:iOS 11.0
CocoaPods
您可以使用 CocoaPods 将 ScrollViewLayout
集成到项目中。只需将以下行添加到您的 Podfile
pod 'ScrollViewLayout', '~> 1.0'
Carthage
如果您偏好,也可以使用 Carthage,通过在您的 Cartfile
中添加以下行来使用它
github "darrarski/ScrollViewLayout" ~> 1.0
使用
示例可以在 ExampleApp 中找到。
快速浏览
let layoutController = ScrollViewLayoutController(
for: subview,
in: scrollView,
using: ScrollViewLayoutUpdater { subview, scrollView in
// update subview's frame or constraints here
}
)
请使用ScrollViewTopBackgroundLayout
或ScrollViewBottomBackgroundLayout
更新器而不是通用的ScrollViewLayoutUpdater
来复现示例应用的行为。只要布局应该应用,就要保持对控制器的强引用。
开发
需求
要配置项目,请运行
bundle install
bundle exec fastlane setup
然后打开Xcode中的ScrollViewLayout.xcodeproj
。
使用ExampleApp
构建方案来构建和运行示例应用。
使用ScrollViewLayout
构建方案来构建和测试框架。
要从命令行运行测试,请执行
bundle exec fastlane test
要生成HTML格式的代码覆盖率报告,请执行
bundle exec fastlane coverage_html
报告将保存到code_coverage
目录。
许可证
MIT许可证 - 请查看LICENSE文件。