如何在xamarin.ios中全局隐藏导航栏后退按钮标题
问题描述:
我在AppDelegate中使用了此代码,
UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment (new UIOffset (-100, -60), UIBarMetrics.Default);
但它的位置已更改为底部.我已经附上了结果截图.
But it position is changed to bottom. I have attached the result screenshot.
答
解决方案1:设置标题颜色"而不是标题位置"
UITextAttributes attribute = new UITextAttributes {TextColor = UIColor.Clear };
UIBarButtonItem.Appearance.SetTitleTextAttributes(attribute, UIControlState.Normal);
解决方案2:仅设置水平偏移.
UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment (new UIOffset (-100, 0), UIBarMetrics.Default);