PJPresentation
Swift
, AutoLayout
, iOS
安装
CocoaPods 是一个 Objective-C / Swift 的依赖关系管理器,它自动并简化了使用诸如 AFNetworking、PJPresentation 这样的第三方库的过程。您可以使用以下命令安装它
$ gem install cocoapods
要构建 PJPresentation 需要 CocoaPods 0.39.0+。
Podfile
要在使用 CocoaPods 的 Xcode 项目中集成 PJPresentation,请在您的 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'TargetName' do
pod 'PJPresentation'
end
然后,运行以下命令
$ pod install
如何使用
let contentView = UIView()
contentView.backgroundColor = .orange
PJPresentationControllerManager.presentView(contentView: contentView, presentationViewControllerHeight: 200.0)
使用 PJPresentationOptions
结构来配置所需效果,例如弹出或消失方向、大小、自定义动画效果等。
var options = PJPresentationOptions()
options.dismissDirection = .topToBottom
options.presentationPosition = .center
options.presentationDirection = .topToBottom
PJPresentationControllerManager.presentView(contentView: contentView, presentationViewControllerHeight: 200, presentationOptions: options)
如何查找
pod search PJPresentation
问答
如果您有任何问题或建议,请联系我([email protected])。
许可
PJPresentation遵循MIT许可协议。详情请见LICENSE文件。