donparalias donparalias - 13 days ago 6
iOS Question

How to fit a text on a table view on iOS?

I have parsed an XML file that is full with articles and every article has a title, a description and a date.

I am parsing this xml and trying to put the information on a table view so that in every cell I can see the title the description and the date of each article.

In every cell I have the title like

cell.textLabel.text = . . .

and the description like
cell.textDetailLabel.text = . . .

and they work fine. How can I add a third line in the cell and also add the date?

Also if the title is very long I cant see it all in my cell. How can I make sure that it fits in the cell? I try to change the font but that just make the letters smaller. I want to use more than one lines to display the title and the description.

Answer

Create your own label and add it on UITableViewCell and create dynamic cell height for cell. refer below url http://www.cimgf.com/2009/09/23/uitableviewcell-dynamic-height/

Comments