测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最后发布 | 2017年8月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Martin Eberl 维护。
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。
EMTransformableNavigationController 可通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile 。
pod 'EMTransformableNavigationController'
Martin Eberl [email protected]
EMTransformableNavigationController 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。
只需将 NavigationController 添加到您的视图中
override func viewDidLoad() {
super.viewDidLoad()
createAndAddTransformableViewController()
}
private func createAndAddTransformableViewController() {
let viewController = UIViewController() //use any viewController
viewController.view.backgroundColor = .lightGray
let navigationController = EMTransformableNavigationController(rootViewController: viewController)
navigationController.add(to: self)
}
使用运动摇晃手势添加 viewController 的更方便的方法
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
if motion == .motionShake {
createTransformableNavigationController()
}
}
要移除 viewController,只需调用
transformableNavigationController.removeFromParentViewController()
//of course the navigationController needed to be stored in a proterty which we called transformableNavigationController
如果您不希望用户移动到可见框架之外,请设置以下属性(默认为 nil,允许用户将导航控制器拖出边界)
transformableNavigationController.allowedFrame = view.bounds
如果您认为用户应允许将视图缩小到特定大小,请设置以下属性(默认为 100x100 像素)
transformableNavigationController.minViewSize = CGSize(width: 300, height: 150)
如果您想知道所有这些是否与自动布局一起工作;它可以,我只是试验了一下:)