Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Niiro13

macrumors 68000
Original poster
Feb 12, 2008
1,719
0
Illinois
Hi!

I'm trying to do something similar in my program as Apple does with events in Calendar where the cell for notes is the size of the string that someone entered for notes. If their note is ten lines long, then so is the cell size in the add/edit/details view.

I cannot figure a way to do this though.

Can someone point me in the right direction?

Thanks!
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
You will probably need a custom table cell. There is a UITableViewDelegate method for giving a custom height for each row. Also look at the sizeWithFont... methods.
 

Niiro13

macrumors 68000
Original poster
Feb 12, 2008
1,719
0
Illinois
Ahh, thanks!

I know that a tableview's cells can have different heights. I was having trouble figuring how to get the height of the text.

Cheers!

Wow, do I feel stupid. I just read the documentation on the constraintosize method. I supposed I've always assumed that the constrainedtosize part needed the text's size (which was what I was trying to find).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.