I had two labels label1 and label2 and a tableview ,when the user click the tableview the content of the tableview is displayed in two labels.means if the tableview cell contain stack and 1 ,1 in the text-label.text. i need to display stack in the label1 and 1 in the label2 ,i have done this .but the problem is when the tableview cell content is big i.e.,instead of stack there is stackoverflow it was overlapped with label2 due to big string content
For example stack:1 is ok but when the content is stackoverflow it will appears stackoverflow1
or stackove…1 something like that.so My need is label2 must change its position according to the string length of label1.How to do this?.i hope u understand my question.
Thanks in advance.
I had two labels label1 and label2 and a tableview ,when the user click
Share
You can get string size with the help of following code
Now you can get frame of the first label and then its text size as well. I hope now it will be easy for you to adjust the postion of second label. In case of any problem let me know.
Here is my code for getting number of lines of a label so that I can get the first label’s height to add the second label after it.
Now you can use this rowHeigh as frame.origin.y of your second label.
Best of luck