我想知道我在这里是否遗漏了一些东西。
在xaml for iOS中使用FontAwesome时,它可以正常工作:
<Button Text="" HeightRequest="100" BackgroundColor="DarkRed" TextColor="White" FontSize="36">
<Button.FontFamily>
<OnPlatform x:TypeArguments="x:String" Android="fa-regular-400.ttf#Font Awesome 5 Free Regular" iOS="Font Awesome 5 Free" WinPhone="Assets/fa-regular-400.ttf#Font Awesome 5 Free" />
</Button.FontFamily>
</Button>
但是当在页面后面的代码中执行此操作时,我没有获得图标,但是它的unicode 
;
这是代码背后的代码:
var newBtn = new Button()
{
Text = "",
HeightRequest = 100,
BackgroundColor = Color.DarkRed,
TextColor = Color.White,
FontSize = 36
};
newBtn.FontFamily = Device.RuntimePlatform == Device.iOS ? "Font Awesome 5 Free" : null;
在C#代码中使用时,必须像这样使用它:
Text = "\uf11a"