本文整理汇总了C#中UIToolbar.AddConstraints方法的典型用法代码示例。如果您正苦于以下问题:C# UIToolbar.AddConstraints方法的具体用法?C# UIToolbar.AddConstraints怎么用?C# UIToolbar.AddConstraints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIToolbar
的用法示例。
在下文中一共展示了UIToolbar.AddConstraints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUpToolbar
void SetUpToolbar ()
{
toolbar = new UIToolbar {
TranslatesAutoresizingMaskIntoConstraints = false
};
chatInputView = new ChatInputView {
TranslatesAutoresizingMaskIntoConstraints = false
};
View.AddSubview (toolbar);
var pinLeft = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, View, NSLayoutAttribute.Leading, 1, 0);
View.AddConstraint (pinLeft);
var pinRight = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, View, NSLayoutAttribute.Trailing, 1, 0);
View.AddConstraint (pinRight);
toolbarBottomConstraint = NSLayoutConstraint.Create (View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1, 0);
View.AddConstraint (toolbarBottomConstraint);
toolbarHeightConstraint = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0, 44);
View.AddConstraint (toolbarHeightConstraint);
toolbar.AddSubview (chatInputView);
var c1 = NSLayoutConstraint.FromVisualFormat ("H:|[chat_container_view]|",
NSLayoutFormatOptions.DirectionLeadingToTrailing,
"chat_container_view", chatInputView
);
var c2 = NSLayoutConstraint.FromVisualFormat ("V:|[chat_container_view]|",
NSLayoutFormatOptions.DirectionLeadingToTrailing,
"chat_container_view", chatInputView
);
toolbar.AddConstraints (c1);
toolbar.AddConstraints (c2);
}