CustomeHeightPresentationController
这是一个小巧的库(一个 UIViewController
),使弹出屏幕的显示变得容易得多。它模仿了 UIActionSheet
的弹出动画和感觉,但把所有设计留给了开发者。自定义控制器从屏幕底部动画弹出,而“下面”的视图将变为灰色。点击弹出视图的任何位置都可以取消显示控制器。
示例
要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install
要求
安装
CustomeHeightPresentationController 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'CustomHeightPresentationController'
创建一个遵循 CustomHeightPresentable
的 UIViewController,并在 init() 中添加以下内容
modalPresentationStyle = .custom
transitioningDelegate = self
然后在该控制器 UIViewControllerTransitioningDelegate
的扩展中添加以下内容
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
return CustomHeightPresentationController(presentedViewController: presented, presenting: presenting)
}
作者
Joe Masilotti, [email protected]
许可证
CustomHeightPresentationController 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。