STPopup Swift 版

783 阅读1分钟
原文链接: github.com

Overview

There are two ways to provide,formSheetbottomSheet,and you can customize backgroundView. You just need to touch the bar and then move down to close.

Installtion

  • Cocoapods

pod MTPopup

  • Carthage

github "huangboju/MTPopup"

Usage

  • BottomSheet
class YourController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        contentSizeInPopup = CGSize(width: 300, height: 200)
        landscapeContentSizeInPopup = CGSize(width: 400, height: 200)
    }
}

let popupController = MTPopupController(rootViewController: YourController())
popupController.style = .bottomSheet // Default is formSheet
popupController.present(in: self)
  • Custom backgroundView
let popupController = MTPopupController(rootViewController: YourController())

let blurEffect = UIBlurEffect(style: .dark)
popupController.backgroundView = UIVisualEffectView(effect: blurEffect)
popupController.backgroundView?.alpha = 0.8
popupController.present(in: self)