SwiftPopup 5.0.0

SwiftPopup 5.0.0

CatchZeng维护。



  • 作者:
  • CatchZeng

SwiftPopup

Swift Version License Platform

⚠️ 为了与iOS 9.0+(Swift 4.x)一起使用,请确保您正在使用 >= 4.2.0。 ⚠️

⚠️ 为了与iOS 10.0+(Swift 5.x)一起使用,请确保您正在使用 >= 5.0.0。 ⚠️

特性

  • swift 5.0
  • 完全自定义组件
  • 支持自动旋转
  • 支持IBInspectable
  • 良好适应

要求

  • iOS 10.0+

示例

要运行示例项目,请克隆仓库,然后首先从示例目录运行pod install

Effect

用法

创建 SwiftPopup 子类。

class YourCustomPopupViewController: SwiftPopup {
}

显示

yourCustomPopupViewController.show()

在视图控制器之上显示

yourCustomPopupViewController.show(above: viewController)

在视图控制器之上显示并带有完成回调

yourCustomPopupViewController.show(above: viewController) {
    //Handle cpmpletion.
}

关闭

yourCustomPopupViewController.dismiss()

关闭并带有完成回调

dismiss {
    //Handle cpmpletion.
}

isShowing

if yourCustomPopupViewController.isShowing {
    //Handle showing.
} else {
    //Handle is not showing.
}

BackView 颜色,支持 IBInspectable。

backViewColor: UIColor

IBInspectable

自定义 animatedTransitioning,默认为 SwiftPopupShowAnimation&SwiftPopupDismissAnimation。如果您不喜欢默认动画,可以将 showAnimation&dismissAnimation 设置为您想要的,例如 ActionSheetAnimation

showAnimation: UIViewControllerAnimatedTransitioning
dismissAnimation: UIViewControllerAnimatedTransitioning

SwiftPopupShowAnimation&SwiftPopupDismissAnimation 属性。

yourCustomPopupViewController.showAnimation.duration = 2.0
yourCustomPopupViewController.showAnimation.delay = 1.0
yourCustomPopupViewController.showAnimation.springWithDamping = 1.0
yourCustomPopupViewController.showAnimation.springVelocity = 0.0

安装

SwiftPopup 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile

pod 'SwiftPopup'

// iOS 9.0+
pod 'SwiftPopup', '~> 4.2.0'

// iOS 10.0+
pod 'SwiftPopup', '~> 5.0.0'

作者

CatchZeng, [email protected]

许可协议

SwiftPopup 在 MIT 许可协议下可用。有关更多信息,请参阅 LICENSE 文件。