Iconize icon indicating copy to clipboard operation
Iconize copied to clipboard

Create label in code

Open wmcainsh opened this issue 8 years ago • 2 comments

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

wmcainsh avatar Jun 01 '17 15:06 wmcainsh

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" }

jsmarcus avatar Jun 01 '17 17:06 jsmarcus

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" }

wmcainsh avatar Jun 02 '17 06:06 wmcainsh