可取消显示 1.3.0

Dismissible 1.3.0

[younatics]维护。



  • 作者
  • Seungyoun Yi

Dismissible

Version Carthage Compatible License: MIT Platform Swift 4.0

简介

⚡️通过拖动来取消显示模态视图!Dismissible通过手势取消显示非常方便!

demo

要求

Dismissible是用Swift 4.2编写的。兼容iOS 9.0+

安装

CocoaPods

Dismissible 通过 CocoaPods 提供使用。安装它,只需将以下行添加到您的Podfile中

pod 'Dismissable'

Carthage

github "younatics/Dismissable"

使用方法

符合 DismissTriggerUsable 的条件时,显示模态 ViewController

class ViewController: UIViewController, DismissTriggerUsable

在模态 ViewController 中符合 DismissableUsable

class DetailViewController: UIViewController, DismissableUsable

在存在的模态视图上添加 dismissable

let vc = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "detail") as! DetailViewController
self.present(vc, animated: true, completion: nil)

// Add optional scrollView argument when you need to prevent scroll event when offset is big
vc.setup(self, scrollView: vc.tableView)

您还可以自定义消失动画

var dismissAnimator: DismissAnimator = {
  let animator = DismissAnimator()
  animator.transitionDuration = 0.35
  animator.dimmedViewStartColor = UIColor.black.withAlphaComponent(0.4)
  animator.dimmedViewEndColor = UIColor.black.withAlphaComponent(0)
  return animator
 }()

参考资料

如果您在您的应用程序中使用此库,请告诉我或发起pull请求 :)

作者

younatics Twitter

许可

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