Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4 from teambition/feature/support-max-height
Browse files Browse the repository at this point in the history
feat: support modify max height
  • Loading branch information
suricforever authored Oct 22, 2019
2 parents 230f8d7 + 39ce7b2 commit 6bc7c94
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions AlertController/AlertController/AlertController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ open class AlertController: UIViewController {
// AlertView
open var alertView = UIView()
open var alertViewBackgroundColor = UIColor.white
// max height for alert view
// if zero, max height will be 70% of screen height
open var alertViewMaxHeight: CGFloat = 0
fileprivate var alertViewWidth: CGFloat = 270.0
fileprivate var alertViewHeightConstraint: NSLayoutConstraint?
fileprivate var alertViewPadding: CGFloat = 16.0
Expand Down Expand Up @@ -576,8 +579,13 @@ open class AlertController: UIViewController {
// Reload AlertView Height
func reloadAlertViewHeight() {
let screenSize = self.presentingViewController != nil ? self.presentingViewController!.view.bounds.size : UIScreen.main.bounds.size
let maxHeight = screenSize.height * 0.7

let maxHeight: CGFloat
if alertViewMaxHeight != 0 {
maxHeight = alertViewMaxHeight
} else {
maxHeight = screenSize.height * 0.7
}

// for avoiding constraint error
buttonAreaScrollViewHeightConstraint?.constant = 0

Expand Down

0 comments on commit 6bc7c94

Please sign in to comment.