本文整理汇总了C#中UITextField.CenterX方法的典型用法代码示例。如果您正苦于以下问题:C# UITextField.CenterX方法的具体用法?C# UITextField.CenterX怎么用?C# UITextField.CenterX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITextField
的用法示例。
在下文中一共展示了UITextField.CenterX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowView
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)
);
}