0

I'm having some trouble understanding how I should implement a detailed view controller for a table view, when I don't know how long/short the content is going to be.

Think of an RSS app. The main table view shows all the items, and when you click, you're supposed to get the contents of that item/article. How could I solve this using table views for the application, when table cells have a static height?

I'm using storyboard and segues for the application.

rebellion
  • 6,628
  • 11
  • 48
  • 79
  • Is there a specific reason that you want to use a tableview to present the details of the item? I mean it does make more sense to present a full screen/scene as the detail of the item. – Alladinian Jun 11 '13 at 08:29

2 Answers2

0

For your detail view you could place some or all of your content in a UIScrollView.

By the way, table cell heights are not static - just implelemt heightForRowAtIndexPath to calculate the height from your model data. If the cell contains text you will need to calculate the size given the required font. (Theres an answer on how to do this on StackOverflow here )

Community
  • 1
  • 1
Jasper Blues
  • 28,258
  • 22
  • 102
  • 185
0

you can use following method to calculate dynamic height of row and lable as well.Use it in detail view.I think it will resolve your query.

Use it in heightForRowAtIndexPath for setting cell height and in cellForRowAtIndexPath for setting height of lable.

-

(CGFloat) GetHeightFoText:(NSString *)aStrTxt  FoWidth:(int)aIntWidth ForFontSize:(int)aIntFntSize
{
    CGSize maximumLabelSize = CGSizeMake(aIntWidth,9999);
    CGSize expectedLabelSize = [text sizeWithFont:[UIFont systemFontOfSize:aIntFntSize]
                                constrainedToSize:maximumLabelSize
                                    lineBreakMode:UILineBreakModeWordWrap];
    return expectedLabelSize.height;
}
cjd
  • 549
  • 3
  • 11