My code is like this:
var nameTextField = new UITextField();
var passwordTextField = new UITextField();
var loginButton = new UIButton();
//Bindings with MvvmCross...
Add(nameTextField);
Add(passwordTextField);
Add(loginButton);
View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
View.AddConstraints(
nameTextField.AtTopOf(View, 10),
nameTextField.AtLeftOf(View, 10),
nameTextField.AtRightOf(View, 10),
passwordTextField.Below(nameTextField, 10),
passwordTextField.WithSameLeft(nameTextField),
passwordTextField.WithSameRight(nameTextField),
loginButton.Below(passwordTextField, 30),
loginButton.WithSameLeft(passwordTextField),
loginButton.WithSameRight(passwordTextField)
);
With "nameTextField.AtTopOf(view, 10), the form is displayed on the top screen. But now, I need to align vertically all the controls (name, password and button) in the View.
How can I do this?
I already tried to sum the height with the margins of all controls and use .WithCenterY(View).Minus(value), but I think that's not the best way, especially when I have many controls.
Thanks.