From 3580739b8d6e66162238d6f9d2a34eec3d3b2662 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Tue, 3 Nov 2020 09:41:34 +0800 Subject: [PATCH] Amends contsraints on HostingControllers This has the effect of pushing the explainer text up to the centre alignment of the tableviews. --- .../Accounts/AccountsPreferencesViewController.swift | 8 ++++++-- .../ExtensionPointPreferencesViewController.swift | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift index ab2393748..d28ff36e7 100644 --- a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift +++ b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift @@ -231,7 +231,6 @@ private extension AccountsPreferencesViewController { controller.view.translatesAutoresizingMaskIntoConstraints = false detailView.addSubview(controller.view) detailView.addFullSizeConstraints(forSubview: controller.view) - } func hideController() { @@ -252,7 +251,12 @@ private extension AccountsPreferencesViewController { addChild(textHostingController) textHostingController.view.translatesAutoresizingMaskIntoConstraints = false detailView.addSubview(textHostingController.view) - detailView.addFullSizeConstraints(forSubview: textHostingController.view) + detailView.addConstraints([ + NSLayoutConstraint(item: textHostingController.view, attribute: .top, relatedBy: .equal, toItem: detailView, attribute: .top, multiplier: 1, constant: 1), + NSLayoutConstraint(item: textHostingController.view, attribute: .bottom, relatedBy: .equal, toItem: detailView, attribute: .bottom, multiplier: 1, constant: -deleteButton.frame.height), + NSLayoutConstraint(item: textHostingController.view, attribute: .width, relatedBy: .equal, toItem: detailView, attribute: .width, multiplier: 1, constant: 1) + ]) + } } diff --git a/Mac/Preferences/ExtensionPoints/ExtensionPointPreferencesViewController.swift b/Mac/Preferences/ExtensionPoints/ExtensionPointPreferencesViewController.swift index eca8dc36a..8250a185a 100644 --- a/Mac/Preferences/ExtensionPoints/ExtensionPointPreferencesViewController.swift +++ b/Mac/Preferences/ExtensionPoints/ExtensionPointPreferencesViewController.swift @@ -192,7 +192,11 @@ private extension ExtensionPointPreferencesViewController { addChild(textHostingController) textHostingController.view.translatesAutoresizingMaskIntoConstraints = false detailView.addSubview(textHostingController.view) - detailView.addFullSizeConstraints(forSubview: textHostingController.view) + detailView.addConstraints([ + NSLayoutConstraint(item: textHostingController.view, attribute: .top, relatedBy: .equal, toItem: detailView, attribute: .top, multiplier: 1, constant: 1), + NSLayoutConstraint(item: textHostingController.view, attribute: .bottom, relatedBy: .equal, toItem: detailView, attribute: .bottom, multiplier: 1, constant: -deleteButton.frame.height), + NSLayoutConstraint(item: textHostingController.view, attribute: .width, relatedBy: .equal, toItem: detailView, attribute: .width, multiplier: 1, constant: 1) + ]) } }