本文整理汇总了C#中UIBarButtonItem.SetTitlePositionAdjustment方法的典型用法代码示例。如果您正苦于以下问题:C# UIBarButtonItem.SetTitlePositionAdjustment方法的具体用法?C# UIBarButtonItem.SetTitlePositionAdjustment怎么用?C# UIBarButtonItem.SetTitlePositionAdjustment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIBarButtonItem
的用法示例。
在下文中一共展示了UIBarButtonItem.SetTitlePositionAdjustment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: ViewDidLoad
/// <summary>
/// Views the did load.
/// </summary>
///
public override void ViewDidLoad ()
{
ECLSUIUtil.TryAction<ECLSPopover> ("ViewDidLoad", () => {
base.ViewDidLoad ();
// default frame size
this.View.Frame = OnGetFrame ();
if (_style == ECLSPopoverStyle.OkCancel) {
_navigationBar = new UINavigationBar (
CGRect.FromLTRB (0, 0, UIApplication.SharedApplication.Delegate.GetWindow ().Frame.Width, 44)
);
_navigationBar.BackgroundColor = UIColor.DarkGray; //UIColor.FromRGB (175,1,83); //magenta
// _navigationBar.TintColor = UIColor.FromRGB (175,1,83); // UIColor.White;
_leftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Cancel);
_rightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done);
_leftBarButtonItem.SetTitlePositionAdjustment (new UIOffset (15f, 0), UIBarMetrics.Default);
_rightBarButtonItem.SetTitlePositionAdjustment (new UIOffset (-15f, 0), UIBarMetrics.Default);
UINavigationItem navItem = new UINavigationItem () {
LeftBarButtonItem = _leftBarButtonItem,
RightBarButtonItem = _rightBarButtonItem,
};
_navigationBar.SetItems (
new UINavigationItem[] { navItem }, false
);
_navigationBar.ClipsToBounds = false;
_buttonItemHandler = new ECLSPopoverButtonItemHandler (
navItem.LeftBarButtonItem, navItem.RightBarButtonItem
);
_buttonItemHandler.NotifyComplete = this.NotifyComplete;
this.View.AddSubview (_navigationBar);
this.View.AddSubview (
new UIView (CGRect.FromLTRB (0, _navigationBar.Frame.Height, this.View.Bounds.Right, this.View.Bounds.Bottom)) {
BackgroundColor = UIColor.FromRGB (240, 232, 236),
Alpha = .95f
}
);
/*this.View.AddSubview(
new UIImageView(UIImage.FromFile(@"Images/Background_Calculating_Full.png").StretchableImage(0, 5)) {
Frame = RectangleF.FromLTRB(0, _navigationBar.Frame.Height, this.View.Bounds.Right, this.View.Bounds.Bottom)
}
); */
} else if (_style == ECLSPopoverStyle.Activity) {
/*this.View.AddSubview(
new UIImageView(UIImage.FromFile(@"Images/Background_Calculating_Full.png").StretchableImage(0, 5)) {
Frame = this.View.Bounds
}
);
*/
this.View.AddSubview (new UIView (this.View.Bounds) {
BackgroundColor = UIColor.Black,
//BackgroundColor = UIColor.FromRGB (175,1,83), //magenta
Alpha = .75f
});
_activityLabel = new UILabel () {
Frame = CGRect.FromLTRB (this.View.Frame.Left, (_frameHeight / 2), this.View.Frame.Width, (_frameHeight / 2) + 31 /* adjusted below */),
TextAlignment = UITextAlignment.Center,
Lines = 3,
LineBreakMode = UILineBreakMode.WordWrap,
BackgroundColor = UIColor.Clear,
Opaque = true,
TextColor = UIColor.White,
Text = this.Title,
ShadowColor = UIColor.Black,
ShadowOffset = new CGSize (0f, -1.0f),
Font = ECLSUIUtil.HelveticaNeueBold (24.0f)
};
CGSize labelSize = ECLSUIUtil.LabelRequiredSize (_activityLabel, this.Title);
_activityLabel.Frame = CGRect.FromLTRB (
_activityLabel.Frame.Left, _activityLabel.Frame.Top, _activityLabel.Frame.Right, _activityLabel.Frame.Top + labelSize.Height
);
this.View.AddSubview (_activityLabel);
_activityIndicator = new UIActivityIndicatorView () {
HidesWhenStopped = true,
Center = new CGPoint (
this.View.Frame.Width / 2, (_frameHeight / 2) - 20
)
};
this.View.AddSubview (_activityIndicator);
_activityIndicator.StartAnimating ();
} else if (_style == ECLSPopoverStyle.Plain) {
_activityLabel = new UILabel () {
//.........这里部分代码省略.........