Author Topic: REQUEST: Number of printed lines in UILabel  (Read 9099 times)

LightStorm

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 17
    • View Profile
REQUEST: Number of printed lines in UILabel
« on: April 23, 2014, 04:51:33 AM »
Could you please add number of printed lines to UILabel component? Sometimes it's very useful to see how many lines of text was used.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: REQUEST: Number of printed lines in UILabel
« Reply #1 on: April 23, 2014, 06:19:17 AM »
label.text.Split('\n').Length;

LightStorm

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 17
    • View Profile
Re: REQUEST: Number of printed lines in UILabel
« Reply #2 on: April 23, 2014, 07:54:20 AM »
Yes, but I need number of printed lines when I use fixed width for label and text was wrapped.
How can I do that?
« Last Edit: April 23, 2014, 08:00:49 AM by LightStorm »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: REQUEST: Number of printed lines in UILabel
« Reply #3 on: April 23, 2014, 08:02:29 AM »
label.processedText.Split('\n').Length;

LightStorm

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 17
    • View Profile
Re: REQUEST: Number of printed lines in UILabel
« Reply #4 on: April 23, 2014, 08:38:03 AM »
Thanks.
BTW: It's works but this solution is time consuming especially with big amount of text.