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:

upload_2019-5-6_17-16-20-png.80126


were not displaying in the actual program:

upload_2019-5-6_17-16-49-png.80127


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.
 
Top