Saturday, October 24, 2015

I now work at tretton37!

Sometimes you need to do something new in life. And when the best company in the world gives you an opportunity to be a part of their awesomeness, you just don't say no.

I now work at tretton37 (1337), still doing Xamarin stuff of course! Check it out at

Have a great day!

Tuesday, October 6, 2015

FontAwesome using Xamarin Forms and iOS

This is the same post as the one for Android, except this one is for iOS. I didn't really plan to write this one since the same info can be found However, I got some comments about the previous post being incomplete, so I guess I have to complete myself.

Read this one first to get the background -

I also moved the source to github since I might be adding stuff to it as I go along. Find it under johankson/awesome.

Here we go!

Download the font

Download the FontAwesome font and drop it in your Resource folder for the iOS project. Remember to change the "Copy to output directory" to "Always", otherwise you'll get a null reference exception.

Edit the info.plist file

In the root of your iOS project you'll find a file called info.plist. We need to add stuff to it by editing the file using a text editor. If you simply double click it then Xamarin Studio (or Visual Studio) will open a GUI for it. We don't want that. I recommend Sublime Text for all you text editing needs.

Add a key named UIAppFonts followed by an array. One entry in the array should point to the font, in this case the fontawesome.ttf. If you have multiple fonts just add more entries. Make sure you add the complete path if you add the font to a folder.

Edit the XAML

Add a FontFamily attribute to what ever control you'd like display an icon through. The FontFamily attribute will be ignored on Android so you still need the custom renderer covered in the last blog post. The XAML is from the file MyPage.Xaml in the Forms project.

The result

As expected, we see some FontAwesome icons. 


Remember that you can adjust the size and color by using the FontSize and TextColor properties. You can also add icons to buttons.

    <Button Text="&#xf041;" FontSize="40" FontFamily="FontAwesome" />


So you see that iOS is simpler than Android when it comes to using custom fonts. I also know at the time of writing I haven't created a Windows Phone solution yet. I will as soon as time permits.