WSPopup
一种简单灵活的显示弹窗的方式。这是我们一直在每个项目中实现的功能,所以决定将其放入一个可重用的框架中。
它像 UIViewController
一样工作,但会处理您的 UIView
(您想要显示的视图)的布局功能,甚至处理您视图的任何输入的关键盘事件。
示例
您有一个 SignInView
,当用户凭据过期时,您想显示它。
let exampleSignInView = ExampleSignInView()
exampleSignInView.userTextField.text = "JohnDoe123"
let popupViewController = WSPopupViewController(popupView: exampleSignInView)
popupViewController.modalPresentationStyle = . overFullScreen
popupViewController.modalTransitionStyle = .crossDissolve
show(popupViewController, sender: self)
您也可以只给 UIView
类型
let popupViewController = WSPopupViewController(popupViewType: ExampleSignInView.self)
popupViewController.modalPresentationStyle = .overFullScreen
popupViewController.modalTransitionStyle = .crossDissolve
show(popupViewController, sender: self)
请查阅我们的示例应用。
安装
Carthage
要安装它,只需将以下行添加到您的 Cartfile
github "whitesmith/WSPopup"
然后运行 carthage update
。
请按照Carthage的README中的当前说明操作,获取最新的安装说明。
手动操作
下载所有源文件并将它们放入你的项目中。
需求
- iOS 11.0+
- Xcode 10+ (Swift 5.0)
贡献
最好的贡献方式是提交一个pull request。我们将尽快回复你的补丁。如果你发现错误或有问题,也可以提交一个新的GitHub问题。