本文整理汇总了C#中UISegmentedControl.SetDividerImage方法的典型用法代码示例。如果您正苦于以下问题:C# UISegmentedControl.SetDividerImage方法的具体用法?C# UISegmentedControl.SetDividerImage怎么用?C# UISegmentedControl.SetDividerImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISegmentedControl
的用法示例。
在下文中一共展示了UISegmentedControl.SetDividerImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TTTProfileIconTableViewCell
public TTTProfileIconTableViewCell(UITableViewCellStyle style, string reuseIdentifier)
: base(style, reuseIdentifier)
{
UIImage x = TTTProfile.ImageForIcon (TTTProfileIcon.X).
ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
UIImage o = TTTProfile.ImageForIcon (TTTProfileIcon.O).
ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
SegmentedControl = new UISegmentedControl (new object[] { x, o }) {
Frame = new RectangleF (UIScreen.MainScreen.Bounds.Width / 2 - 120, 0, 240, 80),
AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin |
UIViewAutoresizing.FlexibleBottomMargin
};
UIEdgeInsets capInsets = new UIEdgeInsets (6f, 6f, 6f, 6f);
SegmentedControl.SetBackgroundImage (
UIImage.FromBundle ("segmentBackground").CreateResizableImage (capInsets),
UIControlState.Normal, UIBarMetrics.Default);
SegmentedControl.SetBackgroundImage (
UIImage.FromBundle ("segmentBackgroundHighlighted").CreateResizableImage (capInsets),
UIControlState.Highlighted, UIBarMetrics.Default);
SegmentedControl.SetBackgroundImage (
UIImage.FromBundle ("segmentBackgroundSelected").CreateResizableImage (capInsets),
UIControlState.Selected, UIBarMetrics.Default);
SegmentedControl.SetDividerImage (
UIImage.FromBundle ("segmentDivider"), UIControlState.Normal,
UIControlState.Normal, UIBarMetrics.Default);
UIView containerView = new UIView (SegmentedControl.Frame) {
Frame = ContentView.Bounds,
AutoresizingMask =
UIViewAutoresizing.FlexibleWidth |
UIViewAutoresizing.FlexibleHeight
};
containerView.AddSubview (SegmentedControl);
ContentView.AddSubview (containerView);
}
示例2: 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);
//
// });
}
示例3: StyleSegmentedControl
public static void StyleSegmentedControl(string style, UISegmentedControl control)
{
control.SetBackgroundImage (UIArtwork[String.Format("{0}_unsel", style)], UIControlState.Normal, UIBarMetrics.Default);
control.SetBackgroundImage (UIArtwork[String.Format("{0}_sel", style)], UIControlState.Selected, UIBarMetrics.Default);
control.SetDividerImage (UIArtwork[String.Format("{0}_unsel_unsel", style)], UIControlState.Normal, UIControlState.Normal, UIBarMetrics.Default);
control.SetDividerImage (UIArtwork[String.Format("{0}_sel_unsel", style)],
UIControlState.Selected,
UIControlState.Normal,
UIBarMetrics.Default
);
control.SetDividerImage (
UIArtwork[String.Format("{0}_unsel_sel", style)],
UIControlState.Normal,
UIControlState.Selected,
UIBarMetrics.Default
);
}