本文整理汇总了C#中UIView.InsertSubview方法的典型用法代码示例。如果您正苦于以下问题:C# UIView.InsertSubview方法的具体用法?C# UIView.InsertSubview怎么用?C# UIView.InsertSubview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIView
的用法示例。
在下文中一共展示了UIView.InsertSubview方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupUi
private void SetupUi()
{
try
{
//set the selection style
this.SelectionStyle = UITableViewCellSelectionStyle.None;
//set the background color of the cell to the same color of the tableView
this.BackgroundColor = Helper.Theme.Color.C19;
//set the border of the cell to be a little lighter, this will give it the look that the cell is floating in space by having the business card view's background color white
//create a inner view that we change the background color and all content in. This will make the content look like it's floating in the table view
_innerView = new UIView
{
BackgroundColor = Helper.Theme.Color.C1,
TranslatesAutoresizingMaskIntoConstraints = false,
Layer = {
BorderColor = Helper.Theme.Color.C20.CGColor,
BorderWidth = 1.0f,
}
};
//add the innerView into the contentview of the cell and attach it to the top, bottom, left, and right side of the cell
this.ContentView.InsertSubview(_innerView, 0);
AutoLayoutHelper.AttachToParentHorizontally(this.ContentView, _innerView, 0);
AutoLayoutHelper.AttachToParentVertically(this.ContentView, _innerView, 4);
//setup header labels
_companyName = new UILabel
{
TranslatesAutoresizingMaskIntoConstraints = false,
Font = Helper.Theme.Font.F2(Helper.Theme.Font.H6),
TextColor = Helper.Theme.Color.C13,
LineBreakMode = UILineBreakMode.WordWrap,
Lines = 0
};
_innerView.InsertSubview(_companyName, 0);
//setup _companyName layout in innerView below _jobName
AutoLayoutHelper.AttachToParentTop(_innerView, _companyName, 4);
AutoLayoutHelper.AttachToParentHorizontally(_innerView, _companyName, 10);
_officeLocation = new UILabel
{
TranslatesAutoresizingMaskIntoConstraints = false,
Font = Helper.Theme.Font.F2(Helper.Theme.Font.H6),
TextColor = Helper.Theme.Color.C13,
LineBreakMode = UILineBreakMode.WordWrap,
Lines = 0
};
_innerView.InsertSubview(_officeLocation, 0);
//setup _officeLocation layout in innerView below _jobName
AutoLayoutHelper.FollowControlVertically(_innerView, _companyName, _officeLocation, 2);
AutoLayoutHelper.AttachToParentHorizontally(_innerView, _officeLocation, 10);
_jobName = new UILabel
{
TranslatesAutoresizingMaskIntoConstraints = false,
Font = Helper.Theme.Font.F2(Helper.Theme.Font.H4),
TextColor = Helper.Theme.Color.C3,
LineBreakMode = UILineBreakMode.WordWrap,
Lines = 0
};
_innerView.InsertSubview(_jobName, 0);
//setup _jobName layout in innerview
AutoLayoutHelper.FollowControlVertically(_innerView, _officeLocation, _jobName, 10);
AutoLayoutHelper.AttachToParentHorizontally(_innerView, _jobName, 10);
_topDivider = new UIView
{
TranslatesAutoresizingMaskIntoConstraints = false,
BackgroundColor = Helper.Theme.Color.C19
};
_innerView.InsertSubview(_topDivider, 0);
AutoLayoutHelper.FollowControlVertically(_innerView, _jobName, _topDivider, 6);
AutoLayoutHelper.AttachToParentHorizontally(_innerView, _topDivider, 4);
AutoLayoutHelper.SetHeight(_topDivider, 1.0f);
//setup the middle row of due date and status
_dueDateView = new UIView
{
TranslatesAutoresizingMaskIntoConstraints = false,
};
_innerView.InsertSubview(_dueDateView, 0);
AutoLayoutHelper.FollowControlVertically(_innerView, _topDivider, _dueDateView, 1);
AutoLayoutHelper.AttachToParentLeft(_innerView, _dueDateView, 10);
_dueDate = new UILabel
{
TranslatesAutoresizingMaskIntoConstraints = false,
Font = Helper.Theme.Font.F2(Helper.Theme.Font.H6),
TextColor = Helper.Theme.Color.C3,
LineBreakMode = UILineBreakMode.Clip
};
_dueDateView.InsertSubview(_dueDate, 0);
//.........这里部分代码省略.........