CustomModalTransition
这是一个用于 Swift 或 Objective-C 的简单框架,用于以模态方式显示您自己的控制器。您只需将变量放入要模态显示的控制器中,如下所示
let modalTransitor = CustomModalTransition(option: .center, horizontalInsets: 20, hiewHeight: 262)
并将此变量设置为过渡代理
let vc = SomeUIViewController.instantiateViewController(withIdentifier: "SomeID")
vc.modalPresentationStyle = .custom
vc.transitioningDelegate = vc.modalTransitor
有两种可用的显示选项
- .center(对于 Objective-C:UICustomTransitionOptionCenter)- 模态视图控制器将在屏幕中心显示
- .bottom(对于 Objective-C:UICustomTransitionOptionBottom)- 它将在屏幕底部显示。
参数 horizontalInsets 负责从左到右的内边距,在底部选项中,它还负责底部内边距。