ScrollViewController
包装您自定义视图并在屏幕上以填充可见区域的方式呈现它(不被导航栏、键盘等覆盖)。如果您的自定义视图太大,您将能够滚动内容,这得益于嵌入的UIScrollView
。
从版本v1.1.0
开始,ScrollViewController不再依赖于
KeyboardFrameChangeListener
用于观察键盘框架更改,然后使用ScrollViewKeyboardAvoider
调整间距,以便键盘不覆盖内容。支持“安全区域布局”,使内容填充可见区域。
设计用于在iPhone(包括iPhone X)的竖屏方向上工作(也应支持其他屏幕方向以及iPad屏幕)。
安装
最低部署目标:iOS 10.0(在iOS >= 11上使用Safe Area Layout以兼容iPhone X)。
使用Swift 4.2开发的最后一个版本是v1.0.12
。
Swift 包管理器
ScrollViewController
与 Swift Package Manager 兼容。您可以将它作为依赖项添加到您的 Xcode 项目 或 Swift 包 中。
CocoaPods
您可以使用 CocoaPods 在项目中集成 ScrollViewController
。只需将以下行添加到您的 Podfile
中:
pod 'ScrollViewController', '~> 1.3'
Carthage
如果您更喜欢使用 Carthage,您可以将以下行添加到您的 Cartfile
中:
github "darrarski/ScrollViewController" ~> 1.3
使用
示例可以在 DemoApp 中找到。
TL;DR
let yourContentView: UIView
let scrollViewController = ScrollViewController()
scrollViewController.contentView = yourContentView
开发
要求
要初始化项目,请运行:
bundle install
然后在 Xcode 中打开 ScrollViewController.xcodeproj
文件。
使用 DemoApp
构建方案构建和运行示例应用程序。
使用 Tests
构建方案以执行测试。
要检查 pod,请运行:
bundle exec pod lib lint --allow-warnings
要部署 pod,请运行:
bundle exec pod trunk push --allow-warnings
☕️ 你喜欢这个项目吗?
许可
版权所有 © 2022 Dariusz Rybicki Darrarski