本文整理汇总了C#中UISegmentedControl.SizeThatFits方法的典型用法代码示例。如果您正苦于以下问题:C# UISegmentedControl.SizeThatFits方法的具体用法?C# UISegmentedControl.SizeThatFits怎么用?C# UISegmentedControl.SizeThatFits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISegmentedControl
的用法示例。
在下文中一共展示了UISegmentedControl.SizeThatFits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadIPadLayout
void loadIPadLayout()
{
CGSize desiredSize = CGSize.Empty;
this.offset = 0;
if (sections.Count == 0 && options.Count == 1)
{
UIButton button = new UIButton (UIButtonType.RoundedRect);
button.SetTitle (options [0].OptionText, UIControlState.Normal);
button.AddTarget (optionTouched, UIControlEvent.TouchUpInside);
desiredSize = button.SizeThatFits (this.View.Bounds.Size);
button.Frame = new CGRect (30, 10 + this.headerHeight, desiredSize.Width, desiredSize.Height);
this.View.AddSubview (button);
this.offset = (float)(10 + desiredSize.Height + 10);
}
else if (options.Count >= 3 || sections.Count > 0)
{
settingsButton = new UIBarButtonItem (new UIImage ("menu.png"), UIBarButtonItemStyle.Plain, settingsTouched);
this.NavigationItem.RightBarButtonItem = settingsButton;
}
else
{
UISegmentedControl segmented = new UISegmentedControl ();
for (int i = 0; i < options.Count; i++) {
segmented.InsertSegment (options [i].OptionText, i + 1, false);
}
desiredSize = segmented.SizeThatFits (this.View.Bounds.Size);
segmented.Frame = new CGRect (10, 10 + this.headerHeight, desiredSize.Width, desiredSize.Height);
segmented.AddTarget (optionTouched, UIControlEvent.ValueChanged);
this.View.AddSubview (segmented);
segmented.SelectedSegment = this.SelectedOption;
this.offset = (float)(10 + desiredSize.Height + 10);
}
}