本文整理汇总了C#中UILabel.Left方法的典型用法代码示例。如果您正苦于以下问题:C# UILabel.Left方法的具体用法?C# UILabel.Left怎么用?C# UILabel.Left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UILabel
的用法示例。
在下文中一共展示了UILabel.Left方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateView
private void CreateView(string title, int tag, CustomUIViewController TabViewController){
TabViewController.View = new UIView ();
TabViewController.View.BackgroundColor = UIColor.White;
var vacationType = new UILabel ();
vacationType.Text = title;
TabViewController.View.Add (vacationType);
var vacationStartDate = new UILabel ();
vacationStartDate.Text = _localizer.Localize("startDate");
TabViewController.View.Add (vacationStartDate);
var vacationStartDateBtn = new UIButton ();
vacationStartDateBtn.SetTitle(DateTime.Now.ToString("d"), UIControlState.Normal);
vacationStartDateBtn.SetTitleColor(UIColor.Blue, UIControlState.Normal);
vacationStartDateBtn.Tag = STARTDATE_TAG + tag;
TabViewController.View.Add (vacationStartDateBtn);
var vacationEndDate = new UILabel ();
vacationEndDate.Text = _localizer.Localize("endDate");
TabViewController.View.Add (vacationEndDate);
var vacationEndDateBtn = new UIButton ();
vacationEndDateBtn.SetTitle(DateTime.Now.ToString("d"), UIControlState.Normal);
vacationEndDateBtn.SetTitleColor(UIColor.Blue, UIControlState.Normal);
vacationEndDateBtn.Tag = ENDDATE_TAG + tag;
TabViewController.View.Add (vacationEndDateBtn);
var vacationError = new UILabel ();
vacationError.Text = "";
vacationError.TextColor = UIColor.Red;
vacationError.Lines = 0;
vacationError.LineBreakMode = UILineBreakMode.WordWrap;
vacationError.Tag = ERROR_TAG + tag;
TabViewController.View.Add (vacationError);
var vacationPickImageFromGallery = new UIButton ();
vacationPickImageFromGallery.SetTitle(_localizer.Localize("pickImgFromGallery"), UIControlState.Normal);
vacationPickImageFromGallery.SetTitleColor(UIColor.Blue, UIControlState.Normal);
vacationPickImageFromGallery.Tag = PICKIMAGE_TAG + tag;
TabViewController.View.Add (vacationPickImageFromGallery);
var vacationImageView = new UIImageView ();
vacationImageView.Tag = IMAGE_TAG + tag;
TabViewController.View.Add (vacationImageView);
var vacationCreateBtn = new UIButton ();
vacationCreateBtn.SetTitle(_localizer.Localize("create"), UIControlState.Normal);
vacationCreateBtn.SetTitleColor(UIColor.Blue, UIControlState.Normal);
vacationCreateBtn.Tag = CREATE_TAG + tag;
TabViewController.View.Add (vacationCreateBtn);
TabViewController.View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
var screen = UIScreen.MainScreen.Bounds;
var screenWidth = (float)screen.Width;
var screenHeight = (float)screen.Height;
if (InterfaceOrientation == UIInterfaceOrientation.Portrait) {
TabViewController.View.AddConstraints (
vacationType.Top().EqualTo().TopOf(TabViewController.View).Plus(screenWidth/2),
vacationType.CenterX().EqualTo().CenterXOf(TabViewController.View)
);
} else {
TabViewController.View.AddConstraints (
vacationType.Top().EqualTo().TopOf(TabViewController.View).Plus(50),
vacationType.CenterX().EqualTo().CenterXOf(TabViewController.View)
);
}
TabViewController.View.AddConstraints (
vacationStartDate.Top().EqualTo().BottomOf(vacationType).Plus(10),
vacationStartDate.CenterX().EqualTo().CenterXOf(TabViewController.View).Minus(70),
vacationStartDate.Left().EqualTo().LeftOf(TabViewController.View).Plus(5),
vacationStartDateBtn.Top().EqualTo().BottomOf(vacationType).Plus(3),
vacationStartDateBtn.Right().EqualTo().RightOf(TabViewController.View).Minus(5),
vacationEndDate.Top().EqualTo().BottomOf(vacationStartDateBtn).Plus(3),
vacationEndDate.CenterX().EqualTo().CenterXOf(TabViewController.View).Minus(70),
vacationEndDate.Left().EqualTo().LeftOf(TabViewController.View).Plus(5),
vacationEndDateBtn.Top().EqualTo().BottomOf(vacationStartDateBtn).Minus(5),
vacationEndDateBtn.Right().EqualTo().RightOf(TabViewController.View).Minus(5),
vacationCreateBtn.Top().EqualTo().BottomOf(vacationEndDate).Plus(5),
vacationCreateBtn.CenterX().EqualTo().CenterXOf(TabViewController.View),
vacationError.Top().EqualTo().BottomOf(vacationCreateBtn),
vacationError.CenterX().EqualTo().CenterXOf(TabViewController.View),
vacationError.Width().LessThanOrEqualTo(screenWidth),
vacationPickImageFromGallery.Top().EqualTo().BottomOf(vacationError).Minus(10),
vacationPickImageFromGallery.CenterX().EqualTo().CenterXOf(TabViewController.View),
vacationImageView.Top().EqualTo().TopOf(vacationPickImageFromGallery).Plus(30),
//.........这里部分代码省略.........
示例2: ShowView
private void ShowView(){
var startDate = (new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddMilliseconds (VTSModelTmp.VTSModel.StartDate).ToLocalTime ();
var endDate = (new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddMilliseconds (VTSModelTmp.VTSModel.EndDate).ToLocalTime ();
_vacationType = new UILabel ();
_vacationType.Text = VTSModelTmp.VTSModel.VacationType;
View.Add (_vacationType);
_vacationStartDate = new UILabel ();
_vacationStartDate.Text = _localizer.Localize("startDate");
View.Add (_vacationStartDate);
_vacationStartDateBtn = new UIButton ();
_vacationStartDateBtn.SetTitle(startDate.ToString("d"), UIControlState.Normal);
_vacationStartDateBtn.SetTitleColor(UIColor.Blue, UIControlState.Normal);
View.Add (_vacationStartDateBtn);
_vacationEndDate = new UILabel ();
_vacationEndDate.Text = _localizer.Localize("endDate");
View.Add (_vacationEndDate);
_vacationEndDateBtn = new UIButton ();
_vacationEndDateBtn.SetTitle(endDate.ToString("d"), UIControlState.Normal);
_vacationEndDateBtn.SetTitleColor(UIColor.Blue, UIControlState.Normal);
View.Add (_vacationEndDateBtn);
_vacationStatusTitle = new UILabel ();
_vacationStatusTitle.Text = _localizer.Localize("status");
View.Add (_vacationStatusTitle);
_vacationStatus = new UILabel ();
_vacationStatus.Text = _localizer.Localize("cancelled");
View.Add (_vacationStatus);
_vacationError = new UILabel ();
_vacationError.Text = "";
//_vacationError.Text = _localizer.Localize("dateError");
_vacationError.LineBreakMode = UILineBreakMode.WordWrap;
_vacationError.Lines = 0;
_vacationError.TextColor = UIColor.Red;
View.Add (_vacationError);
_vacationPickImageFromGallery = new UIButton ();
_vacationPickImageFromGallery.SetTitle(_localizer.Localize("pickImgFromGallery"), UIControlState.Normal);
_vacationPickImageFromGallery.SetTitleColor(UIColor.Blue, UIControlState.Normal);
View.Add (_vacationPickImageFromGallery);
_vacationImageView = new UIImageView ();
if (VTSModelTmp.VTSModel.Image != null) {
NSData imageData = NSData.FromArray(VTSModelTmp.VTSModel.Image);
_vacationImageView.Image = UIImage.LoadFromData(imageData);
}
View.Add (_vacationImageView);
_vacationUpdateBtn = new UIButton ();
_vacationUpdateBtn.SetTitle(_localizer.Localize("update"), UIControlState.Normal);
_vacationUpdateBtn.SetTitleColor(UIColor.Blue, UIControlState.Normal);
View.Add (_vacationUpdateBtn);
View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
var screen = UIScreen.MainScreen.Bounds;
var screenWidth = (float)screen.Width;
var screenHeight = (float)screen.Height;
View.AddConstraints (
_vacationType.Top().EqualTo().TopOf(View).Plus(screenHeight/5),
_vacationType.CenterX().EqualTo().CenterXOf(View),
_vacationStartDate.Top().EqualTo().BottomOf(_vacationType).Plus(10),
_vacationStartDate.CenterX().EqualTo().CenterXOf(View).Minus(70),
_vacationStartDate.Left().EqualTo().LeftOf(View).Plus(5),
_vacationStartDateBtn.Top().EqualTo().BottomOf(_vacationType).Plus(3),
_vacationStartDateBtn.Right().EqualTo().RightOf(View).Minus(5),
_vacationEndDate.Top().EqualTo().BottomOf(_vacationStartDateBtn).Plus(3),
_vacationEndDate.CenterX().EqualTo().CenterXOf(View).Minus(70),
_vacationEndDate.Left().EqualTo().LeftOf(View).Plus(5),
_vacationEndDateBtn.Top().EqualTo().BottomOf(_vacationStartDateBtn).Minus(5),
_vacationEndDateBtn.Right().EqualTo().RightOf(View).Minus(5),
_vacationStatusTitle.Top().EqualTo().BottomOf(_vacationEndDate).Plus(10),
_vacationStatusTitle.CenterX().EqualTo().CenterXOf(View).Minus(50),
_vacationStatusTitle.Left().EqualTo().LeftOf(View).Plus(5),
_vacationStatus.Top().EqualTo().BottomOf(_vacationEndDateBtn).Plus(4),
_vacationStatus.Right().EqualTo().RightOf(View).Minus(5)
);
if (VTSModelTmp.VTSModel.Status != "greenCircle.png") {
View.AddConstraints (
_vacationUpdateBtn.Top().EqualTo().BottomOf(_vacationStatusTitle),
_vacationUpdateBtn.CenterX().EqualTo().CenterXOf(View),
_vacationError.Top().EqualTo().BottomOf(_vacationUpdateBtn),
//.........这里部分代码省略.........