本文整理汇总了C#中UIToolbar.AddConstraint方法的典型用法代码示例。如果您正苦于以下问题:C# UIToolbar.AddConstraint方法的具体用法?C# UIToolbar.AddConstraint怎么用?C# UIToolbar.AddConstraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIToolbar
的用法示例。
在下文中一共展示了UIToolbar.AddConstraint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupToolbar
private void SetupToolbar()
{
toolbar = new UIToolbar (new CoreGraphics.CGRect (0, 0, 0, 44));
textbox = new UITextView (CoreGraphics.CGRect.FromLTRB (0, 0, 0, 0));
textbox.BackgroundColor = UIColor.White;
//textbox.Delegate = new TextDelegate ();
textbox.Font = UIFont.SystemFontOfSize (UIFont.SystemFontSize);
textbox.Layer.BorderColor = UIColor.FromRGB ((nfloat)200 / 255, (nfloat)200 / 255, (nfloat)200 / 255).CGColor;
textbox.Layer.BorderWidth = (nfloat)0.5;
textbox.Layer.CornerRadius = 5;
textbox.ScrollsToTop = false;
textbox.TextContainerInset = new UIEdgeInsets (3, 3, 3, 3);
toolbar.AddSubview (textbox);
sendButton = new UIButton (UIButtonType.System);
sendButton.Enabled = false;
sendButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize (UIFont.SystemFontSize);
sendButton.SetTitle ("Send", UIControlState.Normal);
sendButton.SetTitleColor (UIColor.FromRGB (142, 142, 142), UIControlState.Disabled);
sendButton.SetTitleColor (UIColor.FromRGB (1, 122, 255), UIControlState.Normal);
sendButton.ContentEdgeInsets = new UIEdgeInsets (6, 6, 6, 6);
//sendButton.AddTarget (sendAction, UIControlEvent.TouchUpInside);
toolbar.AddSubview (sendButton);
textbox.TranslatesAutoresizingMaskIntoConstraints = false;
sendButton.TranslatesAutoresizingMaskIntoConstraints = false;
toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Left, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Left, 1, 8));
toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Top, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Top, 1, 8));
toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Right, NSLayoutRelation.Equal, sendButton, NSLayoutAttribute.Left, 1, -2));
toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1, -8));
toolbar.AddConstraint (NSLayoutConstraint.Create (sendButton, NSLayoutAttribute.Right, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Right, 1, 0));
toolbar.AddConstraint (NSLayoutConstraint.Create (sendButton, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1, -5));
}