Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Diary App height for entry

I can't get the diary entries to show more than one line. I have made the margins ridiculous numbers and still just one line of text. Any suggestions?

[alt text](file://localhost/Users/jake/Desktop/iOS%20Simulator%20Screen%20shot%20Jun%2020,%202014,%2010.35.53%20AM.png "Title")

CGRect boundingBox = [entry.body boundingRectWithSize:CGSizeMake(200.f, CGFLOAT_MAX)
 options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:@{NSFontAttributeName: font} context:nil];

return MAX(minHeight, CGRectGetHeight(boundingBox) + topMargin + bottomMargin);

code that sets the bounding box

4 Answers

number of lines was set to 1 in storyboard, had to set it to 0 and the app works as it is suppose to.

Jonathan Fernandez
Jonathan Fernandez
8,325 Points

Thanks for this comment. It had helped me get passed the problem as well and I really appreciate this. : )

Yup, had this issue too. Thanks!

Charlie O'Shea
Charlie O'Shea
18,737 Points

This worked for me but I'm sure he still had it set to 1 in the video. Unless he did another one of those really quick fixes.

Ive retyped the code from the videos probably 3 times.

Gregory Serfaty
Gregory Serfaty
37,140 Points

in memory you need to use this method numberOfLines

Andrew Kelly
Andrew Kelly
4,738 Points

Thanks Jake. I was pulling my hair out trying to find the problem too!