CustomAlert refactoring. Using proper UIPresentationController with adaptive margins

This commit is contained in:
relikd
2020-07-01 00:53:25 +02:00
parent 9ece3474c6
commit 92216c0c03
5 changed files with 285 additions and 79 deletions

View File

@@ -7,6 +7,9 @@ struct QuickUI {
x.text = str
x.textAlignment = align
x.font = .preferredFont(forTextStyle: style)
x.constrainHuggingCompression(.horizontal, .defaultLow)
x.constrainHuggingCompression(.vertical, .defaultHigh)
x.sizeToFit()
if #available(iOS 10.0, *) {
x.adjustsFontForContentSizeCategory = true
}
@@ -17,6 +20,7 @@ struct QuickUI {
let x = UIButton(type: .roundedRect)
x.setTitle(title, for: .normal)
x.titleLabel?.font = .preferredFont(forTextStyle: .body)
x.constrainHuggingCompression(.vertical, .defaultHigh)
x.sizeToFit()
if let a = action { x.addTarget(target, action: a, for: .touchUpInside) }
if #available(iOS 10.0, *) {