本文整理汇总了C#中UIBarButtonItem.SetBackButtonTitlePositionAdjustment方法的典型用法代码示例。如果您正苦于以下问题:C# UIBarButtonItem.SetBackButtonTitlePositionAdjustment方法的具体用法?C# UIBarButtonItem.SetBackButtonTitlePositionAdjustment怎么用?C# UIBarButtonItem.SetBackButtonTitlePositionAdjustment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIBarButtonItem
的用法示例。
在下文中一共展示了UIBarButtonItem.SetBackButtonTitlePositionAdjustment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}