本文整理汇总了C#中UILabel.AtLeftOf方法的典型用法代码示例。如果您正苦于以下问题:C# UILabel.AtLeftOf方法的具体用法?C# UILabel.AtLeftOf怎么用?C# UILabel.AtLeftOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UILabel
的用法示例。
在下文中一共展示了UILabel.AtLeftOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadView
public override void LoadView ()
{
View = new UIImageView () {
UserInteractionEnabled = true,
} .Apply (Style.Welcome.Background);
View.Add (logoImageView = new UIImageView ().Apply (Style.Welcome.Logo));
View.Add (sloganLabel = new UILabel () {
Text = "WelcomeSlogan".Tr (),
} .Apply (Style.Welcome.Slogan));
View.Add (createButton = new UIButton ().Apply (Style.Welcome.CreateAccount));
View.Add (passwordButton = new UIButton ().Apply (Style.Welcome.PasswordLogin));
View.Add (googleButton = new UIButton ().Apply (Style.Welcome.GoogleLogin));
createButton.SetTitle ("WelcomeCreate".Tr (), UIControlState.Normal);
passwordButton.SetTitle ("WelcomePassword".Tr (), UIControlState.Normal);
googleButton.SetTitle ("WelcomeGoogle".Tr (), UIControlState.Normal);
createButton.TouchUpInside += OnCreateButtonTouchUpInside;
passwordButton.TouchUpInside += OnPasswordButtonTouchUpInside;
googleButton.TouchUpInside += OnGoogleButtonTouchUpInside;
View.AddConstraints (
logoImageView.AtTopOf (View, 70f),
logoImageView.WithSameCenterX (View),
sloganLabel.Below (logoImageView, 18f),
sloganLabel.AtLeftOf (View, 25f),
sloganLabel.AtRightOf (View, 25f),
googleButton.AtBottomOf (View, 20f),
googleButton.AtLeftOf (View),
googleButton.AtRightOf (View),
googleButton.Height ().EqualTo (60f),
passwordButton.Above (googleButton, 25f),
passwordButton.AtLeftOf (View),
passwordButton.AtRightOf (View),
passwordButton.Height ().EqualTo (60f),
createButton.Above (passwordButton, 5f),
createButton.AtLeftOf (View),
createButton.AtRightOf (View),
createButton.Height ().EqualTo (60f)
);
View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
}
示例2: SetupCell
private void SetupCell(){
BackgroundColor = MobileCore.Values.Colors.BrownGray.ToNative ();
Header = new UILabel{
Frame = new RectangleF(0, 0, UIScreen.MainScreen.Bounds.Width, Constants.Layout.MinimumTouchControlSize),
TextColor = MobileCore.Values.Colors.White.ToNative(),
Lines = 0,
TextAlignment = UITextAlignment.Left
};
Add (Header);
this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
this.AddConstraints (
Header.AtLeftOf(this, Constants.Layout.HorizontalPadding),
Header.AtRightOf(this),
Header.WithSameHeight(this)
);
}
示例3: ConstructDateTimeView
private static void ConstructDateTimeView (UIView view, ref UILabel dateLabel, ref UILabel timeLabel)
{
view.Add (dateLabel = new UILabel ().Apply (Style.EditTimeEntry.DateLabel));
view.Add (timeLabel = new UILabel ().Apply (Style.EditTimeEntry.TimeLabel));
view.AddConstraints (
dateLabel.AtTopOf (view, 10f),
dateLabel.AtLeftOf (view, 10f),
dateLabel.AtRightOf (view, 10f),
timeLabel.Below (dateLabel, 2f),
timeLabel.AtBottomOf (view, 10f),
timeLabel.AtLeftOf (view, 10f),
timeLabel.AtRightOf (view, 10f)
);
view.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
}
示例4: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = UIColorHelpers.GetRandomColor();
var label = new UILabel();
Title = label.Text = $"Page {Number}";
Add(label);
View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
View.AddConstraints(
label.AtTopOf(View, 10f),
label.AtLeftOf(View, 10f),
label.AtRightOf(View, 10f));
}
示例5: ViewDidLoad
public override void ViewDidLoad()
{
View.BackgroundColor = UIColor.White;
base.ViewDidLoad();
// ios7 layout
if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
EdgesForExtendedLayout = UIRectEdge.None;
var fNameLabel = new UILabel {Text = "First"};
Add(fNameLabel);
var sNameLabel = new UILabel {Text = "Last"};
Add(sNameLabel);
var numberLabel = new UILabel {Text = "#"};
Add(numberLabel);
var streetLabel = new UILabel {Text = "Street"};
Add(streetLabel);
var townLabel = new UILabel {Text = "Town"};
Add(townLabel);
var zipLabel = new UILabel {Text = "Zip"};
Add(zipLabel);
var fNameField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect };
Add(fNameField);
var sNameField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect };
Add(sNameField);
var numberField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect };
Add(numberField);
var streetField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect };
Add(streetField);
var townField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect };
Add(townField);
var zipField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect };
Add(zipField);
var debug = new UILabel() { BackgroundColor = UIColor.White, Lines = 0 };
Add(debug);
var set = this.CreateBindingSet<FormView, FormViewModel>();
set.Bind(fNameField).To(vm => vm.FirstName);
set.Bind(sNameField).To(vm => vm.LastName);
set.Bind(numberField).To(vm => vm.Number);
set.Bind(streetField).To(vm => vm.Street);
set.Bind(townField).To(vm => vm.Town);
set.Bind(zipField).To(vm => vm.Zip);
set.Bind(debug).To("FirstName + ' ' + LastName + ', ' + Number + ' ' + Street + ' ' + Town + ' ' + Zip");
set.Apply();
View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
var hMargin = 10;
var vMargin = 10;
View.AddConstraints(
fNameLabel.AtTopOf(View, vMargin),
fNameLabel.AtLeftOf(View, hMargin),
fNameLabel.ToLeftOf(sNameLabel, hMargin),
sNameLabel.WithSameTop(fNameLabel),
sNameLabel.AtRightOf(View, hMargin),
sNameLabel.WithSameWidth(fNameLabel),
fNameField.WithSameWidth(fNameLabel),
fNameField.WithSameLeft(fNameLabel),
fNameField.Below(fNameLabel, vMargin),
sNameField.WithSameLeft(sNameLabel),
sNameField.WithSameWidth(sNameLabel),
sNameField.WithSameTop(fNameField),
numberLabel.WithSameLeft(fNameLabel),
numberLabel.ToLeftOf(streetLabel, hMargin),
numberLabel.Below(fNameField, vMargin),
numberLabel.WithRelativeWidth(streetLabel, 0.3f),
streetLabel.WithSameTop(numberLabel),
streetLabel.AtRightOf(View, hMargin),
numberField.WithSameLeft(numberLabel),
numberField.WithSameWidth(numberLabel),
numberField.Below(numberLabel, vMargin),
streetField.WithSameLeft(streetLabel),
streetField.WithSameWidth(streetLabel),
streetField.WithSameTop(numberField),
townLabel.WithSameLeft(fNameLabel),
townLabel.WithSameRight(streetLabel),
//.........这里部分代码省略.........
示例6: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = UIColor.Blue;
TheViewController = this;
//Enumerate SVG with BundleResource action in the Resources/svg folder
//var path = Path.Combine(NSBundle.MainBundle.BundlePath,"svg");
var bundleSvgs = new List<string>(); //Directory.EnumerateFiles(path, "*.svg").Select(Path.GetFileName).OrderBy(s => s).ToList();
//Enumerate SVG with EmbeddedResource action in the XamSvgDemo.Shared project, in the images folder.
var assembly = typeof (App).GetTypeInfo().Assembly;
var sharedSvgs = assembly.GetManifestResourceNames().Where(n => n.EndsWith(".svg")).OrderBy(n => n).ToArray();
//Combine both lists
var svgNames = bundleSvgs.Select(s => "svg/" + s).Concat(
sharedSvgs.Select(s => "res:" + s)
).ToList();
var index = 0;
#if !USEAUTOLAYOUT
//Fix width, let height be changed by UISvgImageView
var bounds = UIScreen.MainScreen.Bounds;
image = new UISvgImageView(svgNames[index], bounds.Width, 0) { Frame = new CGRect(0,0,bounds.Width, bounds.Height) };
#else
image = new UISvgImageView(svgNames[index]);
#endif
image.Layer.BorderWidth = 1;
image.Layer.BorderColor = UIColor.Green.CGColor;
View.Add(image);
title = new UILabel
{
TextColor=UIColor.White,
Font = UIFont.SystemFontOfSize(14f),
LineBreakMode = UILineBreakMode.CharacterWrap,
Lines = 0,
#if !USEAUTOLAYOUT
Frame = new CGRect(0,30,320,100),
#endif
};
View.Add(title);
#if USEAUTOLAYOUT
var back = new UIView {BackgroundColor = UIColor.DarkGray.ColorWithAlpha(.6f)};
var back2 = new UIView { BackgroundColor = UIColor.Clear };
var inputUrl = new UITextField
{
TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(14f),
AttributedPlaceholder = new NSMutableAttributedString("Enter url of svg file, or tap anywhere for demo",
foregroundColor: UIColor.Gray, font: UIFont.ItalicSystemFontOfSize(12)),
KeyboardType = UIKeyboardType.Url, AutocorrectionType = UITextAutocorrectionType.No,
AutocapitalizationType = UITextAutocapitalizationType.None,
//ReturnKeyType = UIReturnKeyType.Go,
//EnablesReturnKeyAutomatically = true, ShouldReturn =
};
//var inputOk = new UISvgImageView("res:images.download", 25, colorMapping: "000000=FF546D", colorMappingSelected: "000000=00FF59")
//{
// UserInteractionEnabled = true,
//};
var inputOk = new UISvgImageView
{
UserInteractionEnabled = true,
TranslatesAutoresizingMaskIntoConstraints = false,
FillWidth = 25,
ColorMapping="000000=FF546D",
ColorMappingSelected="000000=00FF59",
BundleName = "res:images.download"
};
//var inputOk = new UISvgImageView("", 25); //for debug
View.Add(back);
View.Add(back2);
View.SendSubviewToBack(back);
View.SendSubviewToBack(image); //image behind back
View.Add(inputUrl);
View.Add(inputOk);
inputOk.AddGestureRecognizer(new UITapGestureRecognizer(tap =>
{
inputUrl.ResignFirstResponder();
var dontWait = LoadSvg(inputUrl.Text);
}));
inputUrl.EditingDidBegin += (sender, args) =>
{
inputUrl.SelectAll(this);
};
inputUrl.SetContentHuggingPriority((float)UILayoutPriority.FittingSizeLevel, UILayoutConstraintAxis.Horizontal);
inputOk.SetContentCompressionResistancePriority((float)UILayoutPriority.Required, UILayoutConstraintAxis.Horizontal);
View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
View.AddConstraints(
back.WithSameTop(inputOk).Minus(5),
back.AtLeftOf(View),
back.AtRightOf(View),
back.WithSameBottom(title).Plus(5),
//.........这里部分代码省略.........
示例7: LoadView
public override void LoadView ()
{
base.LoadView ();
isUserLogged = UserDefaults.BoolForKey (IsUserLoggedKey);
isAppActive = UserDefaults.BoolForKey (AppActiveEntryKey);
isAppOnBackground = UserDefaults.BoolForKey (AppBackgroundEntryKey);
marginTop = (isUserLogged && isAppActive) ? 10f : 1f;
height = (isUserLogged && isAppActive) ? 250f : 62f; // 4 x 60f(cells),
var v = new UIView {
BackgroundColor = UIColor.Clear,
Frame = new CGRect (0,0, UIScreen.MainScreen.Bounds.Width, height),
};
v.Add (tableView = new UITableView {
TranslatesAutoresizingMaskIntoConstraints = false,
BackgroundColor = UIColor.Clear,
TableFooterView = new UIView(),
ScrollEnabled = false,
RowHeight = cellHeight,
});
v.Add (openAppView = new UIView {
TranslatesAutoresizingMaskIntoConstraints = false,
Hidden = true,
});
UIView bg;
openAppView.Add (bg = new UIView {
TranslatesAutoresizingMaskIntoConstraints = false,
BackgroundColor = UIColor.Black,
Alpha = 0.1f,
});
UILabel textView;
openAppView.Add (textView = new UILabel {
TranslatesAutoresizingMaskIntoConstraints = false,
Font = UIFont.FromName ("Helvetica", 13f),
Text = isAppActive ? "NoLoggedUser".Tr() : "NoActiveApp".Tr(),
TextColor = UIColor.White,
BackgroundColor = UIColor.Clear,
});
openAppView.Add (openAppBtn = new StartStopBtn {
TranslatesAutoresizingMaskIntoConstraints = false,
IsActive = true,
});
openAppView.AddConstraints (
bg.AtTopOf (openAppView),
bg.AtLeftOf (openAppView),
bg.AtRightOf (openAppView),
bg.AtBottomOf (openAppView),
textView.WithSameCenterY (openAppView),
textView.AtLeftOf (openAppView, 50f),
textView.WithSameHeight (openAppView),
textView.AtRightOf (openAppView),
openAppBtn.Width().EqualTo (35f),
openAppBtn.Height().EqualTo (35f),
openAppBtn.AtRightOf (openAppView, 15f),
openAppBtn.WithSameCenterY (openAppView),
null
);
v.AddConstraints (
tableView.AtTopOf (v),
tableView.WithSameWidth (v),
tableView.Height().EqualTo (height - marginTop).SetPriority (UILayoutPriority.DefaultLow),
tableView.AtBottomOf (v),
openAppView.AtTopOf (v),
openAppView.WithSameWidth (v),
openAppView.Height().EqualTo (cellHeight),
null
);
View = v;
}