I am displaying a long string using UILabel with UILineBreakModeWordWrap. It is showing the string perfectly by wrapping text in UILabel. I want to access last line of UILabel. Does anyone know how to do this on an iPhone?
I am displaying a long string using UILabel with UILineBreakModeWordWrap . It is showing
Share
So I tried some stuff and searched a little around. What you wuld actually need is to count the word wraps and somehow detect the last string. But I didnt really figuere out how to do that.
So my sollution is something like this:
Your String
//I googled some longer StringYour Label:
The call this Method:
getLastLineFromString:looks like this:And The Method
lengthOfString:looks like this:Output:
I know this is not a perfect sollution, but it might help you.