Iconize
Iconize copied to clipboard
Create label in code
Hi,
What's the correct way to do this?
I've tried the following but keep getting a square with a question mark in it:
new IconLabel{ FontSize = 20, Text="\uf164", FontFamily = "FontAwesome" }
new IconLabel{ FontSize = 20, Text="fa-thumbs-up", FontFamily = "FontAwesome" }
new IconLabel{ FontSize = 20, Text="\uf164" }
new IconLabel{ FontSize = 20, Text="fa-thumbs-up" }
I'm working on a xamarin forms project and have installed the latest beta versions of:
- Xam.Plugin.Iconize
- Xam.Plugin.Iconize.FontAwesome
The last one is the correct way, however, have you done all the setup listed in the readme?
Correct
new IconLabel{ FontSize = 20, Text="fa-thumbs-up" }
I think so:
In the forms project, App.Xaml.cs:
Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.FontAwesomeModule());
In the iOS project added the following to info.plist:
<key>UIAppFonts</key> <array> <string>iconize-fontawesome.ttf</string> </array>
In the android project, MainActivity.cs:
Plugin.Iconize.Iconize.Init(Resource.Id.toolbar, Resource.Id.sliding_tabs);
Your example has Resource.Id.tabs but I don't have that available to me. I'm not testing against android anyway so not a big deal just now.
When I run with the code below, the actual text appears i.e. "fa-thumbs-up".
new IconLabel{ FontSize = 20, Text="fa-thumbs-up" }