本文整理汇总了C#中UISwitch.SetState方法的典型用法代码示例。如果您正苦于以下问题:C# UISwitch.SetState方法的具体用法?C# UISwitch.SetState怎么用?C# UISwitch.SetState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISwitch
的用法示例。
在下文中一共展示了UISwitch.SetState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
try
{
this.Title = "SignUp to RDNation";
View.Frame = UIScreen.MainScreen.Bounds;
View.BackgroundColor = UIColor.White;
View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
UIScrollView scroll = new UIScrollView(new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height));
scroll.ContentSize = new SizeF(View.Bounds.Width, 1000);
swith = new UISwitch(new RectangleF(10, 10, 100, 25));
swith.SetState(true, false);
swith.TouchUpInside += swith_TouchUpInside;
scroll.AddSubview(swith);
UILabel doYouDerbyLbl = new UILabel(new RectangleF(80, 15, 200, 25));
doYouDerbyLbl.Text = "Do You Derby?";
scroll.AddSubview(doYouDerbyLbl);
UILabel userNameLbl = new UILabel(new RectangleF(10, 50, View.Bounds.Width, 25));
userNameLbl.Text = "Email:";
scroll.AddSubview(userNameLbl);
userNameTxt = new UITextField(new RectangleF(10, 75, View.Bounds.Width - 20, 35));
userNameTxt.Layer.BorderWidth = 1;
userNameTxt.Layer.MasksToBounds = true;
userNameTxt.Layer.CornerRadius = 8;
userNameTxt.Layer.BorderColor = UIColor.Purple.CGColor;
userNameTxt.Text = SettingsMobile.Instance.User.UserName;
scroll.AddSubview(userNameTxt);
UILabel passwordLbl = new UILabel(new RectangleF(10, 110, View.Bounds.Width, 25));
passwordLbl.Text = "Password:";
scroll.AddSubview(passwordLbl);
passwordTxt = new UITextField(new RectangleF(10, 135, View.Bounds.Width - 20, 35));
passwordTxt.BorderStyle = UITextBorderStyle.RoundedRect;
passwordTxt.Layer.BorderWidth = 1;
passwordTxt.Layer.MasksToBounds = true;
passwordTxt.Layer.CornerRadius = 8;
passwordTxt.Layer.BorderColor = UIColor.Purple.CGColor;
//passwordTxt.SecureTextEntry = true;
scroll.AddSubview(passwordTxt);
derbyNameLbl = new UILabel(new RectangleF(10, 170, View.Bounds.Width, 25));
derbyNameLbl.Text = "Derby Name:";
scroll.AddSubview(derbyNameLbl);
derbyNameTxt = new UITextField(new RectangleF(10, 195, View.Bounds.Width - 20, 35));
derbyNameTxt.BorderStyle = UITextBorderStyle.RoundedRect;
derbyNameTxt.Layer.BorderWidth = 1;
derbyNameTxt.Layer.MasksToBounds = true;
derbyNameTxt.Layer.CornerRadius = 8;
derbyNameTxt.Layer.BorderColor = UIColor.Purple.CGColor;
//passwordTxt.SecureTextEntry = true;
scroll.AddSubview(derbyNameTxt);
firstNameLbl = new UILabel(new RectangleF(10, 230, View.Bounds.Width, 25));
firstNameLbl.Text = "First Name:";
scroll.AddSubview(firstNameLbl);
firstNameTxt = new UITextField(new RectangleF(10, 255, View.Bounds.Width - 20, 35));
firstNameTxt.BorderStyle = UITextBorderStyle.RoundedRect;
firstNameTxt.Layer.BorderWidth = 1;
firstNameTxt.Layer.MasksToBounds = true;
firstNameTxt.Layer.CornerRadius = 8;
firstNameTxt.Layer.BorderColor = UIColor.Purple.CGColor;
scroll.AddSubview(firstNameTxt);
loginBtn = new UIButton(new RectangleF(View.Bounds.Width / 2 - 50, 320, 100, 35));
loginBtn.Layer.BorderWidth = 1;
loginBtn.Layer.MasksToBounds = true;
loginBtn.Layer.CornerRadius = 8;
loginBtn.Layer.BorderColor = UIColor.Purple.CGColor;
loginBtn.SetTitleColor(UIColor.Black, UIControlState.Normal);
loginBtn.SetTitle("Sign Up", UIControlState.Normal);
loginBtn.TouchUpInside += loginBtn_TouchUpInside;
scroll.AddSubview(loginBtn);
warningTxt = new UILabel(new RectangleF(10, 290, View.Bounds.Width - 20, 35));
warningTxt.TextColor = UIColor.Red;
scroll.AddSubview(warningTxt);
View.AddSubview(scroll);
}
catch (Exception exception)
{
ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
}
}
示例2: CreateUISwitch
void CreateUISwitch ()
{
_switch = new UISwitch {Frame = new RectangleF (new PointF(10,10), SizeF.Empty)};
_switch.SetState (true, false);
_switch.ValueChanged += delegate {
_text = _switch.On.ToString ();
_testLabel.Text = _text;
};
View.AddSubview (_switch);
_testLabel = new UILabel { Frame = new RectangleF (10, 200, 100, 50) };
View.AddSubview (_testLabel);
}
示例3: UpdateUiSwitch
private void UpdateUiSwitch(Component component, UISwitch uiSwitch)
{
InvokeOnMainThread(() =>
{
if (component.DeviceStatus == uiSwitch.On) return;
uiSwitch.SetState(component.DeviceStatus, true);
});
}