Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

setting custom font on iOS in a Shared Project

$
0
0

I have tried it on android using a custom renderer, and it works perfectly. For iOS, I followed Micheal James blog on using custom fonts, but it is not working, i get the default font.
Things i did for iOS:
-added the BEAUTYSC.TTF font in the resource folder
-changed its property to always copy and bundle resource
-updated the info.plist by adding a new string entry with the font name

My code on the shared file :
public App ()
{
var headingLabel = new MyLabel {
XAlign = TextAlignment.Center,
Text = "Best Store",
FontFamily = Device.OnPlatform (
"BEAUTYSC",
"BEAUTYSC",
null),
FontSize = 55

            };

            // The root page of your application
            MainPage = new ContentPage {
                Content = new StackLayout {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {headingLabel}
                    }
            };

    }

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>