private void ShowView(){ _image = new UIImageView (); _image.Image = UIImage.FromBundle("logo.png"); View.Add (_image); _username = new UITextField (); _username.Placeholder = _loginViewModel.Localaizer.Localize("username"); _username.TextAlignment = UITextAlignment.Center; View.Add (_username); _password = new UITextField (); _password.Placeholder = _loginViewModel.Localaizer.Localize("password"); _password.TextAlignment = UITextAlignment.Center; _password.SecureTextEntry = true; View.Add (_password); _loginBtn = new UIButton (); _loginBtn.SetTitle(_loginViewModel.Localaizer.Localize("login"), UIControlState.Normal); _loginBtn.SetTitleColor(UIColor.Blue, UIControlState.Normal); View.Add (_loginBtn); _error = new UILabel (); _error.Lines = 0; _error.LineBreakMode = UILineBreakMode.WordWrap; _error.TextColor = UIColor.Red; _error.TextAlignment = UITextAlignment.Center; View.Add (_error); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints (); var screen = UIScreen.MainScreen.Bounds; var screenWidth = (float)screen.Width; //var screenHeight = (float)screen.Height; View.AddConstraints ( _image.Top().EqualTo().TopOf(View).Plus(screenWidth/4), _image.CenterX().EqualTo().CenterXOf(View), _image.Width().LessThanOrEqualTo(200), _image.Height().LessThanOrEqualTo(140), _username.Top().EqualTo().BottomOf(_image), _username.CenterX().EqualTo().CenterXOf(View), _password.Top().EqualTo().BottomOf(_username), _password.CenterX().EqualTo().CenterXOf(View), _loginBtn.Top().EqualTo().BottomOf(_password), _loginBtn.CenterX().EqualTo().CenterXOf(View), _error.Top().EqualTo().BottomOf(_loginBtn), _error.CenterX().EqualTo().CenterXOf(View), _error.Width().LessThanOrEqualTo(screenWidth) ); }