iOS Question [Solved] FontAwesome not working as button icons

emexes

Expert
Licensed User
(re: related thread: https://www.b4x.com/android/forum/threads/fontawesome-icons-in-buttons.80993/ )

I had an issue where FontAwesome icons that looked great in Designer:



were not displaying in the actual program:



and what I eventually tracked it down to was a programming mistake/oversight on my part (hard to believe, I know ;-/ ) when resizing the button label:
B4X:
Dim V As View
For I = 0 To RootPanel.NumberOfViews - 1
    V = RootPanel.GetView(I)
           
    If V Is Button Then
        AsButton = V
        AsLabel = AsButton.CustomLabel

        '*** bad - font changed back to default font ***
        'AsLabel.Font = AsLabel.Font.CreateNew(AsLabel.Font.Size * TextScale)

        '*** good - font unchanged eg remains FontAwesome ***
        AsLabel.Font = AsLabel.Font.CreateNew2(AsLabel.Font.Name, AsLabel.Font.Size * TextScale)
Presumably this issue would also apply where FontAwesome (or other iconic fonts) are used in labels etc too.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…