iOS Question Change part of label text

Yvon Steinthal

Active Member
Licensed User
Longtime User
Hello,

I have looked around the forum but i am not even sure its possible. What i want to do is a label that mentions :"By logging in you accept the Terms and Conditions".

However i would like for the "Terms and Conditions" to be in blue and underline.

Is it possible or do i have to do two different labels to achieve this?

Thanks.

Y.
 

BillMeyer

Well-Known Member
Licensed User
Longtime User
You are right - CS Builder is the go to choice. - There is a very good example here under b4a - but works in b4i as well.
 
Upvote 0

Yvon Steinthal

Active Member
Licensed User
Longtime User
B4X:
cs.Initialize.alignment("ALIGN_LEFT")
     cs.Append("En vous authentifiant vous acceptez les ").Font(Font.CreateNew(12)).Color(Colors.lightgray).Pop.Pop
     cs.Append("Termes et Conditions").Font(Font.createnewbold(12)).color(Colors.blue).pop.pop
     cs.PopAll
  
     lblTandC.AttributedText = cs

This doesn't seem to work... any help?
The Label was created using the designer could that affect the color?

Y.

EDIT:

Fixed it using this code:

B4X:
  cs.Initialize.Color(Colors.ARGB(255,202,194,194)).Append("En vous authentifiant vous acceptez les ")
     cs.Color(Colors.ARGB(255,77,144,254)).append("Termes et Conditions").pop
     cs.Append(".").PopAll
       
     lblTandC.AttributedText = cs
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…