refactored inset logic in helpers
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
25a21fb5b8
commit
8c13c6960d
@ -10,15 +10,15 @@ import VDS
|
||||
import UIKit
|
||||
|
||||
extension UIView {
|
||||
public static func makeWrapper(for view: UIView) -> UIView {
|
||||
public static func makeWrapper(for view: UIView, edgeSpacing: CGFloat = 0.0) -> UIView {
|
||||
let wrapper = UIView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
wrapper.addSubview(view)
|
||||
view
|
||||
.pinTop()
|
||||
.pinBottom()
|
||||
.pinLeading()
|
||||
.pinTop(edgeSpacing)
|
||||
.pinBottom(edgeSpacing)
|
||||
.pinLeading(edgeSpacing)
|
||||
view.trailingAnchor.constraint(lessThanOrEqualTo: wrapper.trailingAnchor).isActive = true
|
||||
return wrapper
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ public class BaseViewController: UIViewController, Initable {
|
||||
viewController.didMove(toParent: self)
|
||||
}
|
||||
|
||||
open func addContentTopView(view: UIView) {
|
||||
open func addContentTopView(view: UIView, edgeSpacing: CGFloat = 16.0) {
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentTopView.addSubview(view)
|
||||
view.pinToSuperView(.init(top: edgeSpacing, left: edgeSpacing, bottom: edgeSpacing, right: edgeSpacing))
|
||||
|
||||
@ -34,7 +34,7 @@ class TooltipViewController: BaseViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: .makeWrapper(for: tooltip))
|
||||
addContentTopView(view: .makeWrapper(for: tooltip, edgeSpacing: 16.0), edgeSpacing: 0.0)
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
@ -102,6 +102,7 @@ class TooltipViewController: BaseViewController {
|
||||
self?.tooltip.fillColor = item
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TooltipPopup: UIAlertController {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user