本文整理汇总了C#中UISegmentedControl.SetTitleTextAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# UISegmentedControl.SetTitleTextAttributes方法的具体用法?C# UISegmentedControl.SetTitleTextAttributes怎么用?C# UISegmentedControl.SetTitleTextAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISegmentedControl
的用法示例。
在下文中一共展示了UISegmentedControl.SetTitleTextAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TabButtonView
public TabButtonView(RectangleF frame, params string[] tabs)
{
this.Frame = frame;
_segment = new UISegmentedControl(tabs);
_segment.ControlStyle = UISegmentedControlStyle.Bar;
_segment.SelectedSegment = 0;
_segment.AutosizesSubviews = true;
_segment.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
_segment.Frame = this.Frame;
//Themeing
var textAttrs = new UITextAttributes { TextColor = UIColor.FromRGB(122, 122, 122), TextShadowColor = UIColor.White, TextShadowOffset = new UIOffset(0, 1) };
_segment.SetTitleTextAttributes(textAttrs, UIControlState.Normal);
//var textAttrsHighlighted = new UITextAttributes { TextColor = UIColor.White, TextShadowColor = UIColor.FromRGB(122, 122, 122), TextShadowOffset = new UIOffset(0, 1) };
//_segment.SetTitleTextAttributes(textAttrsHighlighted, UIControlState.Highlighted);
_segment.SetDividerImage(Images.Components.TabsVertical, UIControlState.Normal, UIControlState.Normal, UIBarMetrics.Default);
_segment.SetBackgroundImage(Images.Components.TabsBackground, UIControlState.Normal, UIBarMetrics.Default);
_segment.SetBackgroundImage(Images.Components.TabsHighlighted, UIControlState.Selected, UIBarMetrics.Default);
AddSubview(_segment);
_segment.ValueChanged += (sender, e) => {
if (SegmentChanged != null)
SegmentChanged(_segment.SelectedSegment);
};
// //Fucking bug in the divider
// BeginInvokeOnMainThread(delegate {
// _segment.SelectedSegment = 1;
// _segment.SelectedSegment = 0;
// _segment.SelectedSegment = MonoTouch.Utilities.Defaults.IntForKey(MultipleSelectionsKey);
// Title = GetTitle(_segment.SelectedSegment);
//
// });
}
示例2: Initialize
void Initialize ()
{
segs = new UISegmentedControl (new [] { "Date", "Name" }) {
};
ApplyTheme (DocumentAppDelegate.Shared.Theme);
if (!ios7) {
segs.TintColor = UIColor.FromWhiteAlpha (165 / 255.0f, 1);
segs.SetTitleTextAttributes (new UITextAttributes {
TextColor = UIColor.FromWhiteAlpha (220 / 255.0f, 1),
TextShadowColor = UIColor.Gray,
TextShadowOffset = new UIOffset (0, -1),
}, UIControlState.Normal);
segs.SetTitleTextAttributes (new UITextAttributes {
TextColor = UIColor.White,
TextShadowColor = UIColor.DarkGray,
TextShadowOffset = new UIOffset (0, -1),
}, UIControlState.Selected);
segs.ControlStyle = UISegmentedControlStyle.Bar;
}
segs.SelectedSegment = sort == DocumentsSort.Name ? 1 : 0;
segs.ValueChanged += HandleValueChanged;
}