【发布时间】:2019-05-27 14:54:17
【问题描述】:
我创建了这个资源:
<?xml version="1.0" encoding="utf-8"?> <Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="CustomFrameApp.App">
<Application.Resources>
<ResourceDictionary>
<OnPlatform x:TypeArguments="x:String" x:Key="NewFont">
<On Platform="iOS" Value="Camber_Medium_Regular" />
</OnPlatform>
</ResourceDictionary>
</Application.Resources> </Application>
添加到 info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIAppFonts</key>
<array>
<string>Camber_Medium_Regular.otf</string>
</array>
</dict>
</plist>
并在我的 XAML 中使用
<Label FontSize="12px" Text="ABCD" TextColor="Black" VerticalOptions="Center" HorizontalOptions="Center" FontFamily="{StaticResource NewFont}" />
但字体仍然没有被使用
我按照建议将它们添加为捆绑资源,它们位于 iOS 的资源文件中
有谁知道可能出了什么问题?
【问题讨论】:
-
假设您的字体名称值不正确:*.com/questions/50011220/…
标签: xamarin xamarin.forms