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


C# UIBarButtonItem.SetBackButtonBackgroundImage方法代码示例

本文整理汇总了C#中UIBarButtonItem.SetBackButtonBackgroundImage方法的典型用法代码示例。如果您正苦于以下问题:C# UIBarButtonItem.SetBackButtonBackgroundImage方法的具体用法?C# UIBarButtonItem.SetBackButtonBackgroundImage怎么用?C# UIBarButtonItem.SetBackButtonBackgroundImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIBarButtonItem的用法示例。


在下文中一共展示了UIBarButtonItem.SetBackButtonBackgroundImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetBarButtonItemAppearance

        public static void SetBarButtonItemAppearance(UIBarButtonItem.UIBarButtonItemAppearance appearance, UIColor color, UIColor highlightedColor, UIColor textColor, float cornerRadius, float borderWidth)
        {
            UIImage backButtonPortraitImage = FlatUI.BackButtonImage(color,
                                                                     UIBarMetrics.Default,
                                                                     cornerRadius,
                                                                     color.Darken(2),
                                                                     borderWidth);
            UIImage highlightedBackButtonPortraitImage = FlatUI.BackButtonImage(highlightedColor,
                                                                                UIBarMetrics.Default,
                                                                                cornerRadius,
                                                                                highlightedColor.Darken(2),
                                                                                borderWidth);
            UIImage backButtonLandscapeImage = FlatUI.BackButtonImage(color,
                                                                      UIBarMetrics.LandscapePhone,
                                                                      cornerRadius,
                                                                      color.Darken(2),
                                                                      borderWidth);
            UIImage highlightedBackButtonLandscapeImage = FlatUI.BackButtonImage(highlightedColor,
                                                                                 UIBarMetrics.LandscapePhone,
                                                                                 cornerRadius,
                                                                                 highlightedColor.Darken(2),
                                                                                 borderWidth);

            appearance.SetBackButtonBackgroundImage(backButtonPortraitImage, UIControlState.Normal, UIBarMetrics.Default);
            appearance.SetBackButtonBackgroundImage(backButtonLandscapeImage, UIControlState.Normal, UIBarMetrics.LandscapePhone);
            appearance.SetBackButtonBackgroundImage(highlightedBackButtonPortraitImage, UIControlState.Highlighted, UIBarMetrics.Default);
            appearance.SetBackButtonBackgroundImage(highlightedBackButtonLandscapeImage, UIControlState.Highlighted, UIBarMetrics.LandscapePhone);

            appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(1f, 1f), UIBarMetrics.Default);
            appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(1f, 1f), UIBarMetrics.LandscapePhone);

            UIImage buttonImageNormal = FlatUI.Image(color, cornerRadius, color.Darken(2), borderWidth);
            UIImage buttonImageHighlighted = FlatUI.Image(highlightedColor, cornerRadius, highlightedColor.Darken(2), borderWidth);

            appearance.SetBackgroundImage(buttonImageNormal, UIControlState.Normal, UIBarMetrics.Default);
            appearance.SetBackgroundImage(buttonImageHighlighted, UIControlState.Highlighted, UIBarMetrics.Default);

            UITextAttributes titleTextAttributes = appearance.GetTitleTextAttributes(UIControlState.Normal);
            if (titleTextAttributes == null)
                titleTextAttributes = new UITextAttributes();
            titleTextAttributes.TextShadowColor = UIColor.Clear;
            titleTextAttributes.TextShadowOffset = new UIOffset(0, 0);
            titleTextAttributes.TextColor = textColor;
            titleTextAttributes.Font = FlatUI.FontOfSize(0);
            appearance.SetTitleTextAttributes(titleTextAttributes, UIControlState.Normal);
            appearance.SetTitleTextAttributes(titleTextAttributes, UIControlState.Highlighted);
        }
开发者ID:natecook1000,项目名称:FlatUIKit.Xamarin,代码行数:47,代码来源:FlatUI.cs

示例2: Apply

		public static void Apply (UIBarButtonItem.UIBarButtonItemAppearance appearance, string options = null)
		{
			if (IsModern)
				return;

			var font = UIFont.FromName (BarButtonFontName, BarButtonFontSize);

			appearance.SetBackgroundImage (
				ButtonImage.Value,
				UIControlState.Normal,
				UIBarMetrics.Default);

			appearance.SetBackButtonBackgroundImage (
				BackButtonImage.Value,
				UIControlState.Normal,
				UIBarMetrics.Default);

			appearance.SetTitlePositionAdjustment (new UIOffset (0, 1), UIBarMetrics.Default);

			appearance.SetTitleTextAttributes (new UITextAttributes {
				TextColor = BarTextColor,
				TextShadowColor = BarButtonTextShadowColor,
				TextShadowOffset = BarButtonTextShadowOffset,
				Font = font,
			}, UIControlState.Normal);

			appearance.SetTitleTextAttributes (new UITextAttributes {
				TextColor = UIColor.FromWhiteAlpha (0.9f, 1),
				TextShadowColor = BarButtonTextShadowColor,
				TextShadowOffset = BarButtonTextShadowOffset,
				Font = font,
			}, UIControlState.Disabled);

			appearance.SetTitleTextAttributes (new UITextAttributes {
				TextColor = UIColor.White,
				TextShadowColor = BarButtonTextShadowColor,
				TextShadowOffset = BarButtonTextShadowOffset,
				Font = font,
			}, UIControlState.Highlighted);
		}
开发者ID:praeclarum,项目名称:Praeclarum,代码行数:40,代码来源:WhiteTheme.cs

示例3: Apply

 /// <summary>
 /// Apply this theme to all views with the given appearance.
 /// </summary>
 /// <param name="options">
 /// "blue", or null
 /// </para>
 public static void Apply(UIBarButtonItem.UIBarButtonItemAppearance appearance, string options = null)
 {
     if (options == "blue") {
         appearance.SetBackgroundImage (blueBarButtonBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
         appearance.SetBackButtonBackgroundImage (blueBackButtonBackBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
     } else {
         appearance.SetBackgroundImage (barButtonBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
         appearance.SetBackButtonBackgroundImage (backButtonBackBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
     }
 }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:16,代码来源:Theme.cs


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