private void InitViews() { itemLabel = UIHelper.CreateLabel(ColorHelper.Default, DimensionHelper.ButtonTextSize); AddSubview(itemLabel); AddConstraints(new [] { NSLayoutConstraint.Create(itemLabel, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.CenterY, 1, 0), NSLayoutConstraint.Create(itemLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.CenterX, 1, 0) }); seperator = UIHelper.CreateView(DimensionHelper.SeperatorHeight, 0, ColorHelper.BlueColor); AddSubview(seperator); AddConstraints(new[] { NSLayoutConstraint.Create(seperator, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Bottom, 1, 0), NSLayoutConstraint.Create(seperator, NSLayoutAttribute.Left, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Left, 1, DimensionHelper.MarginShort), NSLayoutConstraint.Create(seperator, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Right, 1, -DimensionHelper.MarginShort) }); AddGestureRecognizer(new UITapGestureRecognizer(() => { ClickCommand?.Execute(null); })); }
public static PopupItemLabel CreateLabel(UIColor textColor, nfloat fontSize, FontType fontType = FontType.Regular) { var label = new PopupItemLabel { TranslatesAutoresizingMaskIntoConstraints = false, LineBreakMode = UILineBreakMode.WordWrap, TextColor = textColor, Font = GetFont(fontType, fontSize) }; return(label); }