iOS Question get Rect for substring of text in Label

Discussion in 'iOS Questions' started by narek adonts, Mar 24, 2015.

  1. narek adonts

    narek adonts Well-Known Member Licensed User

    Hi,

    Can someone help me to get the Rect for substring of text in Label?

    I want t create a label with clickable links.

    Narek
     
    Last edited: Mar 24, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use String.MeasureWidth to find the width of the substring.
     
  3. narek adonts

    narek adonts Well-Known Member Licensed User

    It should work with multiline
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It should work with multiline strings (strings with CRLF).
     
  5. narek adonts

    narek adonts Well-Known Member Licensed User

    I dont understand. If i want to manage clicks for a special word in a multima label, how String.measurewidth can help me. I need to know the top and left coordinates of the word to put a view on it.

    Narek
     
  6. Brian Robinson

    Brian Robinson Active Member Licensed User

    Not sure I understand what you want?

    Do you want a single label with multiple words in it that link to different places?
     
  7. narek adonts

    narek adonts Well-Known Member Licensed User

    i need a label to be able detect ex. Phone number, URL, Adress,... and manage clicks on it.
    if I will have the Rect of that string I can put a panel for example on it and manage clicks

    Narek
     
  8. narek adonts

    narek adonts Well-Known Member Licensed User

    I managed to create an algorithm which checking which word is on which line but a got stuck on a word which is larger than the label width(is on multiple lines). If this last issue will be resolved we will have a full custom label Class which can handle clicks on specific string.

    Please see attached the project.

    Narek
     

    Attached Files:

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