Xamarin表单UIBarButtonItem自定义字体

Xamarin表单UIBarButtonItem自定义字体,xamarin,xamarin.forms,xamarin.ios,custom-renderer,Xamarin,Xamarin.forms,Xamarin.ios,Custom Renderer,我正试图在Xamarin表单项目的导航栏中使用UIBarbuttonite字体 我的XAML代码 <TabbedPage.ToolbarItems> <ToolbarItem Command="{Binding CreateNewConversation}" Text="&#xf067;" x:Name="NewConversationButton"></ToolbarItem> </TabbedPage.ToolbarItems>

我正试图在Xamarin表单项目的导航栏中使用UIBarbuttonite字体

我的XAML代码

<TabbedPage.ToolbarItems>
    <ToolbarItem Command="{Binding CreateNewConversation}" Text="&#xf067;" x:Name="NewConversationButton"></ToolbarItem>
</TabbedPage.ToolbarItems>
我可以看出属性正在应用,因为我可以看到文本更新的颜色,但我得到了一个?周围有一个正方形的边框。我已经设置了一个断点,并且正在使用正确的字体设置字体。是否有明显的事情表明我做错了

更新:


问题是无法对uibarbuttonite应用粗体字体,我仍然不知道该怎么做。我可以使用不同的图标,但每当我更改选项卡时,图标都会返回到一个正方形,围绕一个?并失去色彩。

再次检查您是否使用了正确的图标代码
,如果字体中有


既然你没有收到任何错误,字体应该找到并正确注册,等等。看起来iOS无法在您的字体文件中找到此特定字符代码。

字体名称似乎正确,但字体注册是否正确:我认为如果没有,将出现nullreference异常,字体无法实例化。您找到解决方案了吗这我正在尝试使用工具栏中的FontAwesome图标-我需要自定义渲染器吗?它必须是FontAwesome具有粗体字体权重的字符。这是我尝试使用的字体,我可能需要将其设置为粗体文本,但无法在此控件上执行此操作。
var _font = UIFont.FromName("Font Awesome 5 Free", 18f);

var rightBarButtonTextAttributes = new UITextAttributes
{
    Font = _font,
    TextColor = UIColor.FromRGB(255, 194, 32),
    TextShadowColor = UIColor.Clear
};

this.NavigationController.TopViewController.NavigationItem.RightBarButtonItem.SetTitleTextAttributes(rightBarButtonTextAttributes, UIControlState.Normal);