如何在xamarin.ios中全局隐藏导航栏后退按钮标题 [英] How to Hide Navigation bar back button title globally in xamarin.ios

查看:178
本文介绍了如何在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);

这篇关于如何在xamarin.ios中全局隐藏导航栏后退按钮标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆