1

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
donparalias
  • 1,834
  • 16
  • 37
  • 60

2 Answers2

0

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/

Mangesh
  • 2,257
  • 4
  • 24
  • 51
  • Ok i followed the tutorial and created my own label exactly as it is shown and works perfect. The problem is that in every cell i want to put 2 different texts together , a title and a summary for example. How can i print those two different labels in the same cell? – donparalias May 31 '12 at 12:41
  • http://www.e-string.com/content/custom-uitableviewcells-interface-builder && http://stackoverflow.com/questions/7818627/how-to-make-uitableview-cell-with-2-labels-of-different-color – Mangesh May 31 '12 at 14:02
  • http://www.iphonesdkarticles.com/2009/02/uitableview-adding-subviews-to-cells.html – Mangesh May 31 '12 at 14:03
0

Use the UITableViewCell class to define exactly how you want your cell to show up. Take a look at the Apple Docs on this (link below), specifically in the 'iPhoneCoreDataRecipes' sample code project. Look at both the the RecipeTableViewCell class and the changes in the cellForRowAtIndexPath: method in RecipeListTableViewController.m

https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html

tarheel
  • 4,727
  • 9
  • 39
  • 52