iOS Code Snippet AttributedStringPlus

Discussion in 'iOS Code Snippets' started by Emme Developer, Jul 26, 2017.

  1. Emme Developer

    Emme Developer Well-Known Member Licensed User

    Sometimes, meanwhile i work with AttributedString, i need to start more Span for a single Text, or i need to load a string from database o file (for example for translate). So i want to share this simple class, that for sure can be extended with other method. This helps to start a span for each words between marker, like RichString.

    Is very easy to use

    Dim l As Label
    Dim st As String = "Very short {b} Text {b} but i {b} want {b} to use Span!"
    Dim at As AttributedStringPlus
        at.Initialize( st.Replace(
        l.AttributedText = at.FormatFont(
    Class uses Regex, so we can't use "{" "}" as marker

    Attached Files:

    Last edited: Jul 26, 2017
  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