How to Hide Navigation bar back button title globa

2019-07-17 06:26发布

问题:

I used this code in AppDelegate,

UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment (new UIOffset (-100, -60), UIBarMetrics.Default);

But it position is changed to bottom. I have attached the result screenshot.

回答1:

Solution1 : set Title Color instead of Title Position

UITextAttributes attribute = new UITextAttributes {TextColor = UIColor.Clear };
UIBarButtonItem.Appearance.SetTitleTextAttributes(attribute, UIControlState.Normal);

Solution2 : set horizontal offset only.

UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment (new UIOffset (-100, 0), UIBarMetrics.Default);