-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new AddViews() and DoNotTranslateSubviewsAutoresizingMaskIntoCons…
…traints() automatically in AddCosntraints() (#29)
- Loading branch information
1 parent
0ba4f6c
commit f73b4a3
Showing
2 changed files
with
6 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,12 @@ | |
// | ||
// Project Lead - Stuart Lodge, @slodge, [email protected] | ||
|
||
using Arbus.iOS.Essentials.BasicViewExtensions; | ||
|
||
namespace Arbus.iOS.Essentials.AutoLayout; | ||
|
||
public static class FluentLayoutExtensions | ||
{ | ||
[Obsolete("Use AddSubviewsForAutoLayout. The method is to be removed in the future.")] | ||
public static void SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(this UIView view) | ||
{ | ||
foreach (var subview in view.Subviews) | ||
subview.TranslatesAutoresizingMaskIntoConstraints = false; | ||
} | ||
|
||
public static UIViewAndLayoutAttribute Left(this UIView view) => view.WithLayoutAttribute(NSLayoutAttribute.Left); | ||
|
||
public static UIViewAndLayoutAttribute Right(this UIView view) => view.WithLayoutAttribute(NSLayoutAttribute.Right); | ||
|
@@ -56,6 +51,7 @@ public static T AddConstraints<T>(this T view, params FluentLayout[] fluentLayou | |
|
||
public static T AddConstraints<T>(this T view, IEnumerable<FluentLayout> fluentLayouts) where T : UIView | ||
{ | ||
view.DoNotTranslateSubviewsAutoresizingMaskIntoConstraints(); | ||
view.AddConstraints(fluentLayouts | ||
.Where(fluent => fluent != null) | ||
.Select(fluent => fluent.Constraint.Value) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters