【问题标题】:How can I change the Font Size and Weight for the Back Arrow and Back Text in a Navigation Page?如何更改导航页面中后退箭头和后退文本的字体大小和粗细?
【发布时间】:2018-02-08 17:54:25
【问题描述】:

我有一个关于如何更改标题字体的类似问题:

How can I change the Font Size and Weight for the Header in a Navigation Page?

现在我已经更改了,有人知道如何更改顶部后退箭头的字体大小和粗细以及导航页面顶部的消息吗?似乎这些不是标题的一部分,因为它们保留了原始字体大小和粗细。

【问题讨论】:

    标签: xamarin xamarin.forms xamarin.ios


    【解决方案1】:

    我认为这个问题只发生在iOS平台,所以解决方法是

    FinishedLaunching 中设置UIBarButtonItem Appearance AppDelegate

    UITextAttributes att = new UITextAttributes();
    att.Font = UIFont.SystemFontOfSize(20.0 , FontAttributes.Bold); // size and weight
    
    UIBarButtonItem.AppearanceWhenContainedIn(new Type[] { typeof( UINavigationBar) }).SetTitleTextAttributes(att, UIControlState.Normal);
    UIBarButtonItem.AppearanceWhenContainedIn(new Type[] { typeof(UINavigationBar) }).SetTitleTextAttributes(att,  UIControlState.Highlighted);
    

    【讨论】:

    • 您好 Cole,您能否在 AppDelegate 中添加更多关于“FinishedLaunching”的信息。我什至不知道有这样的事情。我假设 FinishedLaunching 是一种方法,但 AppDelegate 是什么?
    • @Alan2 AppDelegate.cs是iOS项目中iOS平台类的入口。
    • Xia - 抱歉这么久才回复。我试过了,但它在这里给了我一个错误: UITextAttributes att = new UITextAttributes(); att.Font = UIFont.SystemFontOfSize(20.0, FontAttributes.Bold); // 大小和重量 无法从 double 转换为系统 nfloat 也无法转换为 UIKit.uifontweight
    • @Alan2 更改为UIFont.SystemFontOfSize(20.0f, UIFontWeight.Bold);
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多