当前位置: 首页>>代码示例>>C#>>正文


C# UISegmentedControl.SetTitleTextAttributes方法代码示例

本文整理汇总了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);
            //
            //            });
        }
开发者ID:sergii-tkachenko,项目名称:Gistacular,代码行数:37,代码来源:TabButtonView.cs

示例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;
		}
开发者ID:praeclarum,项目名称:Praeclarum,代码行数:26,代码来源:DocumentThumbnailsView.cs


注:本文中的UISegmentedControl.SetTitleTextAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。