效果图:
自定义下拉view
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton.init(frame: .init(x: 0, y: 0, width: 50, height: 50))
button.backgroundColor = UIColor.red
button.setTitle("弹框", for: .normal)
button.center = self.view.center
button.addTarget(self, action: #selector(showAction), for: .touchUpInside)
self.view.addSubview(button)
}
@objc func showAction() {
let showView = ShowView.init(frame: self.view.bounds)
self.view.window?.addSubview(showView)
showView.animationWithAlertViewWithView()
}
}
<span>```</span>
UIViewController
```swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton.init(frame: .init(x: 0, y: 0, width: 50, height: 50))
button.backgroundColor = UIColor.red
button.setTitle("弹框", for: .normal)
button.center = self.view.center
button.addTarget(self, action: #selector(showAction), for: .touchUpInside)
self.view.addSubview(button)
}
@objc func showAction() {
let showView = ShowView.init(frame: self.view.bounds)
self.view.window?.addSubview(showView)
showView.animationWithAlertViewWithView()
}
}