Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

UIBarButtonItem .SetTitleTextAttributes with new Font

$
0
0

I'm trying to set a font in a UIBarButton Item. I've tried this a number of different ways. this is my most recent attempt in code. I'm trying to load a font who's file name is icomoon.ttf. Unfortunately, all I am getting is the text "xe620" in my button. It is as if the font is not being loaded. The font is stored in the "Resources" directory. I've tried this with the font in other place, with the extension, without the extension, and the font does not seem to display correctly(at all). Suggestions, thoughts comments?

        UITextAttributes icoFontAttribute = new UITextAttributes();

        icoFontAttribute.Font = UIFont.FromName("icomoon", 24);
        icoFontAttribute.TextColor = UIColor.White;
        var btnMap = new UIBarButtonItem ();
        // new UIBarButtonItem ("xe620", UIBarButtonItemStyle.Done, null);
        btnMap.SetTitleTextAttributes (icoFontAttribute, UIControlState.Application);
        btnMap.Title = "xe620";
        btnMap.Style = UIBarButtonItemStyle.Done;

Viewing all articles
Browse latest Browse all 204402

Trending Articles



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