iOS Question Changing Font type on a Label


Active Member
Licensed User
I have the code in B4i and want to implement in B4i.

I have Two Labels to Display Text (Label1 and Label2) and One Label which when clicked, change the font in Label1 and Label2.

the codes are below

 Sub Global
Dim BerckerBlack,bold,hand,script,mina,monospace,serif As Typeface
    Dim normalTypeface As String = "serif"   
Private Label1 as Label
Private Label2 as Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Assign fonts to variables
    BerckerBlack = Typeface.LoadFromAssets("f2.ttf")
    serif = Typeface.SERIF    'this is from the system - Initial typeface
    monospace = Typeface.MONOSPACE    'this is from the system
    bold = Typeface.LoadFromAssets("bold.ttf")
    hand = Typeface.LoadFromAssets("hand.ttf")
    script = Typeface.LoadFromAssets("script.ttf")
    mina = Typeface.LoadFromAssets("f3.ttf")
End Sub

Sub Label3_Click
    Select normalTypeface
        Case "serif"
            label1.Typeface = serif
            labe2.Typeface = serif
            normalTypeface = "monospace"   
        Case "monospace"   
            label1.Typeface = monospace
            label2.Typeface = monospace
            normalTypeface = "bold"
            'switch to next one
        Case "bold"
            label1.Typeface = bold
            label2.Typeface = bold
            normalTypeface = "hand"
        Case "hand"
            label1.Typeface = hand
            label2.Typeface = hand
            normalTypeface = "mina"
        Case "mina"
            label1.Typeface = mina
            label2.Typeface = mina
            normalTypeface = "script"
        Case "script"
            label1.Typeface = script
            label2.Typeface = script
            normalTypeface = "serif"
End Select
End Sub

Thanks You