iOS Question Changing Font type on a Label

Discussion in 'iOS Questions' started by Kope, May 15, 2019.

  1. Kope

    Kope 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 = 
        script = 
        mina = 
    End Sub

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

    Erel Administrator Staff Member Licensed User

  3. Kope

    Kope Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    These attributes must be added to the main module.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice