Cant set the height of my uitableviewcell right - iphone

I set the size of my UITableCellĀ“s with this:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString * vergleich = [nachricht objectAtIndex:indexPath.row];
CGSize size = [vergleich sizeWithFont:[UIFont fontWithName:#"Helvetica" size:14]
constrainedToSize:CGSizeMake(268, MAX_HEIGHT)
lineBreakMode:UILineBreakModeWordWrap];
return size.height + 30;
}
nachricht is a NSArray which contains all the messages. The code just looks how long the message (with a specified font) is and calculate the height. I set + 30, because over the message(UITextView) is a UIlabel.
The UITextView, which should contain the messages, get the size with this code:
- (void)setTweetText:(NSString *)_tweet;{
CGSize size = [_tweet sizeWithFont:[UIFont fontWithName:#"Helvetica" size:14]
constrainedToSize:CGSizeMake(268, MAX_HEIGHT)
lineBreakMode:UILineBreakModeWordWrap];
[textText setFrame:CGRectMake(55, 25, 268, size.height + 10)];
textText.text = _tweet;
[textText sizeToFit];
textText.dataDetectorTypes = UIDataDetectorTypeLink;
}
Now there is a problem and I don't know why: The UITextView is bigger then the cell, even if I set the size of the cell height there is a unpleasant distance between the TextView and the next cell. Why doesn't he get the right height for some cells. Here is an example:
alt text http://img34.imageshack.us/img34/214/bildschirmfoto20100120uw.png

All I can say is in my cellForRowAtIndexPath I use the following and it works. My heightForRowAtIndexPath is nearly identical to yours.
double d = [self tableView:table heightForRowAtIndexPath:indexPath];
UILabel* label = [[[UILabel alloc] initWithFrame:CGRectMake(10, 10, 280, d-20)] autorelease];
label.numberOfLines = 100;
label.lineBreakMode = UILineBreakModeWordWrap;
[label setFont:[UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]];
label.text = [descriptions objectAtIndex:indexPath.section];
[cell.contentView addSubview:label];

one possibility is you have set the CGSize width to be different in each function, for row height you have CGSizeMake(268, MAX_HEIGHT) and for setTweetText it is CGSizeMake(262, MAX_HEIGHT)

its not a good idea to sizeWithFont from that method, its fairly heavy and will chop up your scrolling performance. if possible calculate the heights before and store them for quick access from that method

Related

Dynamic Height For UITableViewCell and The content inside

I have a particularly problem that i can't seem to solve i have looked at my code for a few hours and can't seem to fix the problem.
When i add messages to my tableview the messages overflows the wrapper within the UITableViewCell and sometimes the wrapper gets cutoff by the cell.
How do i make sure that my wrapper is always big enough to hold the txt (lblMessage)
and the cell is big enough to hold the wrapper.
Thanks in advance !
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = [self heightForMessage:indexPath];
if(height < 50)
{
NSLog(#"Normal : %d , row : %d", 100,indexPath.row);
return 100;
}
else
{
NSLog(#"Custom : %f , row : %d", 70 + height,indexPath.row);
return 70 + height;
}
}
-(CGFloat)heightForMessage:(NSIndexPath *)indexPath
{
MessageObject * model = [self.chats objectAtIndex:indexPath.row];
CGSize size = [model.message sizeWithFont:[UIFont fontWithName:#"HelveticaNeue-Light" size:12] constrainedToSize:CGSizeMake(290, 100000) lineBreakMode:NSLineBreakByWordWrapping];
return size.height;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * NewsCellIdentifer = #"NewsCellIdentifier";
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NewsCellIdentifer];
UILabel * lblContact;
UILabel * lblMessage;
UILabel * lblDate;
UIView * wrapper;
if (cell == nil)
{
/* Top menu for login */
wrapper = [[UIView alloc] initWithFrame:CGRectMake(10, 5, 300, 90)];
[wrapper setBackgroundColor:[self.delegate.color colorWithAlphaComponent:0.6f]];
[wrapper.layer setCornerRadius:6.0f];
[wrapper.layer setShadowOffset:CGSizeMake(0, 2)];
[wrapper.layer setShadowRadius:2.0f];
[wrapper.layer setShadowOpacity:0.5f];
[wrapper viewWithTag:19];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NewsCellIdentifer];
/* Contact Name */
lblContact = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 150, 30)];
[lblContact setFont:[UIFont fontWithName:#"HelveticaNeue-Medium" size:13]];
[lblContact setTag:13];
[lblContact setTextColor:[self.delegate colorFromHexString:#"#fffbff"]];
[lblContact setBackgroundColor:[UIColor clearColor]];
/* Received Message */
lblMessage = [[UILabel alloc] initWithFrame:CGRectMake(10, 20, 280, 50)];
[lblMessage setNumberOfLines:0];
[lblMessage setLineBreakMode:NSLineBreakByWordWrapping];
[lblMessage setBackgroundColor:[UIColor clearColor]];
[lblMessage setFont:[UIFont fontWithName:#"HelveticaNeue-Light" size:12]];
[lblMessage setTextColor:[self.delegate colorFromHexString:#"#fffbff"]];
[lblMessage setTag:14];
/* Date received */
lblDate = [[UILabel alloc] initWithFrame:CGRectMake(10, 65, 65, 30)];
[lblDate setText:#"4 hours ago"];
[lblDate setFont:[UIFont fontWithName:#"HelveticaNeue-Light" size:11]];
[lblDate setTextColor:[self.delegate colorFromHexString:#"#fffbff"]];
[lblDate setTag:15];
/* Subview Logic */
[wrapper addSubview:lblContact];
[wrapper addSubview:lblMessage];
[wrapper addSubview:lblDate];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
[cell.contentView addSubview:wrapper];
}
else
{
lblContact = (UILabel *)[cell.contentView viewWithTag:13];
lblMessage = (UILabel *)[cell.contentView viewWithTag:14];
wrapper = [cell.contentView viewWithTag:19];
}
MessageObject * model = [self.chats objectAtIndex:indexPath.row];
CGFloat height = [self heightForMessage:indexPath];
[lblMessage setFrame:CGRectMake(10, 25, 280, height)];
[lblMessage setText:model.message];
[lblContact setText:model.clientModel.firstName];
if(height < 50)
{
NSLog(#"wrapper size : %d for row %d ", 90, indexPath.row);
[wrapper setFrame:CGRectMake(10, 5, 300, 90)];
}
else
{
NSLog(#"wrapper size : %f for row %d ", height + 60, indexPath.row);
[wrapper setFrame:CGRectMake(10, 5, 300, height + 60)];
[lblDate setFrame:CGRectMake(10, height + 20, 65, 30)];
}
[cell.contentView setBackgroundColor:[UIColor greenColor]];
[cell setBackgroundColor:[UIColor clearColor]];
return cell;
}
Consider significantly improve your code...Cause it's almost unreadable now
1) Get rid of hardcode e.g. 20, 280. Instead consider using constants (CONTACT_LABEL_TO_MESSAGE_LABEL_OFFSET, MESSAGE_LABEL_WIDTH)
2) Get rid of adding custom subviews to UITableViewCell and tagging them with hardcoded (see 1) numbers - instead subclass UITableViewCell, Prototype it in .xib or .storyboard, make convinient methods for your class - e.g setDate:, setMessage:, setContactName:. All frames should be calculated in your subclass -layoutSubviews method.
At first look:
1) you set width of 280 to lblMessage, when you constrained it's text to width of 290, it causes wrong height calculation
One of the errors is when you are creating the wrapper view for a new cell the line:
[wrapper viewWithTag:19];
should be:
[wrapper setTag:19];
This probably causes wrapper to be nil when you attempt to resize it on a reused cell.
I recommend using a prototype cell and computing cell heights by literally configuring the prototype with the data for the given index path. Just dequeue a cell (yes, you can do this outside of cellForRowAtIndexPath) and hold onto it for doing height calculations. For dynamic height labels, you'd typically call [label sizeToFit] in the cell's configuration logic. There is a more detailed discussion of this technique in this question.
If you want to take a look at a 3rd-party library, my TLIndexPathTools library provides a base table view class TLTableViewController with built-in support for dynamic row height using prototypes:
For static, non-data driven height, it will return the default height of the prototype. So, if your prototype comes from the Storyboard, it will honor the Storyboard custom cell heights.
For dynamic, data-driven height, any custom cell that implements the TLDynamicHeightView protocol will automatically have the dynamic height calculated.
I'll tell you the approach i used to tackle this issue.
Used an array to store heights (using sizeWithFont). It is deprecated now, so you should try using sizeWithAttributes instead.
Log the height from the array, and the height of the actual label, and see if they match.
Make sure the UIFont used is the same in sizeWithFont, and yourLabel.font.
Check to see if you have taken any kind of padding in the cells, like leaving pixels on the top of the cell.
These are the general tips.
When you create a cell in tableView: cellForRowAtIndexPath: you can store it into a NSMutableArray
Then when tableView: heightForRowAtIndexPath: simply retrieve the cell and specify it height.
It's how I do it most of the time but if you use a lot of cell it might use to much memory.
Or maybe you can only store the size of the cell in the NSMutableArray.
EDIT:
I'm not sure I understand you correctly.
You want your cell to be able to contain you wrapper?
cell.contentView.frame = CGRectMake(0, 0, cell.contentView.frame.size.width, wrapper.frame.origin.y + wrapper.frame.size.height);
Store the cell in an NSMutableArray in tableView: cellForRowAtIndexPath:, retrieve it based on it index in tableView: heightForRowAtIndexPath:
To calculate your Label height you should consider different things, You have to calculate size by keeping text length and its font in mind and the bounds of frame you are adding in. Below is example how to calculate size for dynamic text.
CGSize boundingSize = CGSizeMake(frame.size.width, CGFLOAT_MAX);
CGSize requiredSize = [text sizeWithFont:yourFont constrainedToSize:boundingSize lineBreakMode:NSLineBreakByWordWrapping];

UILabel in a grouped table view's header doesn't wrap text

I have a label whose text is longer that the table view's header containing it, so I want the label to be split into N lines according to the width available. This is my code:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 1) {
UIView *wrapper = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 100)];
[wrapper setBackgroundColor:[UIColor clearColor]];
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 100)];
textLabel.text = NSLocalizedString(#"This is supposed to be a very long text that may fill several lines", #"");
[textLabel setLineBreakMode:UILineBreakModeWordWrap];
[textLabel setNumberOfLines:0];
[wrapper addSubview:textLabel];
return wrapper;
}
else
return nil;
}
However, the label is in a single line and I can't see the end of the text. What am I missing?
Thanks!
You should implement the delegate method heightForHeaderInSection.
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if(section ==1)
return 100;
else
return 0;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 1) {
NSString *text = NSLocalizedString(#"This is supposed to be a very long text that may fill several lines", #"");;
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:10] constrainedToSize:CGSizeMake(self.tableView.frame.size.width, 999) lineBreakMode:NSLineBreakByWordWrapping];
CGRect frame = CGRectZero;
frame.size = size;
UIView *wrapper = [[UIView alloc] initWithFrame:frame];
[wrapper setBackgroundColor:[UIColor clearColor]];
UILabel *textLabel = [[UILabel alloc] initWithFrame:frame];
textLabel.text = NSLocalizedString(#"This is supposed to be a very long text that may fill several lines", #"");
[textLabel setLineBreakMode:UILineBreakModeWordWrap];
[textLabel setNumberOfLines:0];
[wrapper addSubview:textLabel];
return wrapper;
}
else
return nil;
}
use this if you want to support iOS below 6.0
textLabel.lineBreakMode = UILineBreakModeWordWrap;
textLabel.numberOfLines = 0;
As UILineBreakModeWordWrap deprecated now.
otherwise use this
textLabel.lineBreakMode = NSLineBreakByWordWrapping;
textLabel.numberOfLines = 0;
you should set size of label as text in heightForRowAtIndexPath
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *text;
CGSize textViewSize;
int width = 270;
textViewSize = [text sizeWithFont:[UIFont fontWithName:#"Helvetica Neue" size:14.0]
constrainedToSize:CGSizeMake(width, FLT_MAX)
lineBreakMode:UILineBreakModeCharacterWrap];
CGFloat height = MAX(textViewSize.height, 44.0f);
return height;
}
and in cellForRowAtIndexPath write this
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
textViewSize = [text sizeWithFont:[UIFont fontWithName:#"Helvetica Neue" size:14.0]
constrainedToSize:CGSizeMake(width, FLT_MAX)
lineBreakMode:UILineBreakModeCharacterWrap];
// / CGFloat height = MAX(textViewSize.height, 44.0f);
// if (!lblParameter){
// lblParameter = (UILabel*)[cell viewWithTag:1];}
CGFloat height = MAX(textViewSize.height, 44.0f);
[lblParameter setText:text];
[lblParameter setFont:[UIFont fontWithName:#"Helvetica Neue" size:14.0]];
[lblParameter setFrame:CGRectMake(10, 0,width,height)];
[[cell contentView] addSubview:lblParameter];
}
you need caculate the height of uilabel this height equal font size * numberline
It seems that wrapping / formatting will not work on a label inside the header view - presumably because it's inheriting defaults from somewhere. So, a simple solution, which AFAIK breaks no laws, is to put the label inside a view inside the header view.
Using the storyboard, drag a view to the table view controller (above your prototype cell).
Add a second view to this view.
Add the label to this second view. Make sure both views and label are tall enough to allow for multiple lines of text. In the label's attributes, set Lines to 0 and Line Breaks to Word Wrap.
Wrapping will now work as expected.

Cell TextLabel multiline not working anymore

I have a project from a year ago that worked.
I have coded:
cell.textLabel.numberOfLines = 0; // Multiline
to enable multiline text in UITableView cell, and it worked before on iOS 5 (not tested it since beginning of 2012), now the multiline doesn't work, and shows only 2 rows of text in cell.
Did I miss something in iOS 6? Was there some kind of change or bug that causes this?
EDIT: I've tried cell.textLabel.numberOfLines = 5; for testing purposes, and it shows 2 rows again
cell.textLabel.numberOfLines = 0;
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
Write inside cellForRowAtIndexPath
UILabel *lbl = [[UILabel alloc]init];
lbl.text = #"Your text value";
lbl.numberOfLines = 0;
lbl.lineBreakMode = NSLineBreakByWordWrapping;
//Set frame according to string
CGSize size = [lbl.text sizeWithFont:lbl.font
constrainedToSize:CGSizeMake(300, MAXFLOAT)
lineBreakMode:UILineBreakModeWordWrap];
[lbl setFrame:CGRectMake(0 , 0 , size.width , size.height)];
[cell.contentView addSubview:lbl];
Your heightForRowAtIndexPath method should be like this
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *value = [listOfData objectAtIndex:indexPath.row];
CGSize boundingSize = CGSizeMake(300, CGFLOAT_MAX);
CGSize stringSize = [value sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:boundingSize lineBreakMode:UILineBreakModeWordWrap];
return ((stringSize.height>44.00)?stringSize.height:44.00);
}
Note: Things you need to change
Here 300 is width of label . You can place your width here
Your can also change X and Y if it is dynamically added.
UILineBreakModeWordWrap is deprecated in iOS 6. Use NSLineBreakByWordWrapping
If you want to display you cell text with multiple then you can also put UILabel on cell.contentView, and give labelName.numberOfLines = 0 for display text tin multi line.
For EX:
UILabel *lbltitle = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 270, 35)];
lbltitle.backgroundColor = [UIColor clearColor];
NSString *originalString = #" Indian version of this popular search engine. Search the whole web or only webpages from India. Interfaces offered in English, Hindi, Bengali, Telugu, Marathi";
lbltitle.text= originalString;
lbltitle.font =[UIFont fontWithName:#"Arial-BoldMT" size:16];
lbltitle.textAlignment = UITextAlignmentLeft;
lbltitle.numberOfLines = 0;
lbltitle.textColor=[UIColor blackColor];
[cell.contentView addSubview:lbltitle];
Above code is put on cellForRowAtIndexPath method in between
if(cell == nil)
{
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
// Put here Label Code
}
Alos read this How do I create a multiline table cell in iOS?

UILabel doesn't change height on setFrame

I'm trying to change the height of a UILabel depending on how much text is in the label.
I can calculate the size required for the label but when I try to set the UILabel frame it just doesn't change.
Below is my code.
Even if I replace size.height in the last line to something like 500 the size of the UILabel frame doesn't change
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = #"GameItemCell";
GameItemCell *cell = (GameItemCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"GameItemCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
GameItem* item = [_hunt.gameItems objectAtIndex: indexPath.row];
cell.itemHeaderLabel.text = [NSString stringWithFormat:#"#%d - (%d pts)", indexPath.row+1, item.itemPoints];
UILabel* textLabel = cell.itemTextLabel;
textLabel.text = item.itemText;
textLabel.lineBreakMode = NSLineBreakByWordWrapping;
CGRect frame = cell.itemTextLabel.frame;
CGSize textSize = { frame.size.width, 20000.0f };
CGSize sizeOneLine = [#"one line" sizeWithFont:cell.itemTextLabel.font constrainedToSize:textSize lineBreakMode:NSLineBreakByWordWrapping];
CGSize cellTextSize = [item.itemText sizeWithFont:cell.itemTextLabel.font constrainedToSize:textSize lineBreakMode:NSLineBreakByWordWrapping];
CGSize sizeOneLineSpacing = CGSizeMake(sizeOneLine.width, sizeOneLine.height + 3);
NSInteger lines = cellTextSize.height / sizeOneLine.height;
CGSize size = CGSizeMake(frame.size.width, lines * sizeOneLineSpacing.height);
textLabel.frame = CGRectMake(frame.origin.x, frame.origin.y, size.width, size.height);
return cell;
}
You must set the frame of your label in GameItemCell inside -(void)layoutSubviews
Instead of doing all that hard work, try it like:
textLabel.numberOfLines = 0;
textLabel.text = textString;
[textLabel sizeToFit];
remember sizeToFit respect your labels default width, so set width according to your requirement. And then Height will be managed by the sizeToFit method.
In the end you will need to put something like these two methods in your UITableViewCell subclass:
// call this method on your cell, during cellForRowAtIndexPath
// provide your resizing info (frame, height, whatever)
- (void) updateLabelFrame:(CGRect)newLabelFrame {
self.resizedLabelFrame = newLabelFrame;
[self setNeedsLayout];
}
// the actual resize happens here when UIKit gets around to it
- (void) layoutSubviews {
[super layoutSubviews];
self.myLabel.frame = self.resizedLabelFrame;
}
You have missed numberOfLines property to set.
Add :
textLabel.numberOfLines = 0;
CGRect labelFrame = myLabel.frame;
labelFrame.size = [myLabel.text sizeWithFont:myLabel.font constrainedToSize:CGSizeMake(myLabel.frame.size.width, CGFLOAT_MAX)
lineBreakMode:myLabel.lineBreakMode];
cell.textLabel.frame = labelFrame;
numberOfLines
The maximum number of lines to use for rendering text.
The default value for this property is 1. To remove any maximum limit, and use as many lines as needed, set the value of this property to 0.
tack a look UILabel Class Reference
According to your question you can set no of lines
Now number of lines is not set to your label, so set it,
textLabel.numberOfLines = lines;
Yeah, for multiple lines use textLabel.numberOfLines = 0; in cellForRowAtIndexPath
But Still you need to change the height of the cell too:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Calculate new cell height too as you are doing in cellForRowAtIndexPath
return YOUR_SIZE;;
}
Try this :
NSString *text1 = shareObjC.commentText;
CGSize constraint1 = CGSizeMake(280 - (size.width + 5), 2000);
CGSize size1 = [text1 sizeWithFont:[UIFont systemFontOfSize:12] constrainedToSize:constraint1 lineBreakMode:UILineBreakModeWordWrap];
UILabel *lblComment = [[[UILabel alloc] initWithFrame:CGRectMake(posx,posy,size1.width,size1.height)] autorelease];
lblComment.lineBreakMode = UILineBreakModeWordWrap;
lblComment.numberOfLines = size1.height/15;
[lblComment setFont:[UIFont systemFontOfSize:12]];
lblComment.text = text1;
[cell.viewLikeComment addSubview:lblComment];

UITableViewCell dynamic height with label

I have created a UITableViewCell with a NIB file.
There is 1 label in it which is going to contain a tweet. So it needs to be a dynamic height. There also is a timeAgo label that has to fit underneath the tweet label.
I'm trying stuff with frames en sizes but I can't get the perfect solution..
I do this in the UITableViewCell file in the drawrect method.
self.tweet.lineBreakMode = UILineBreakModeWordWrap;
self.tweet.numberOfLines = 0;
self.tweet.font = [UIFont fontWithName:#"Arial" size:13.0f];
[self.tweet sizeToFit];
CGFloat tweetHeight = self.tweet.frame.size.height;
self.timeAgo.lineBreakMode = UILineBreakModeWordWrap;
self.timeAgo.numberOfLines = 0;
self.timeAgo.font = [UIFont fontWithName:#"Arial" size:11.0f];
[self.timeAgo sizeToFit];
CGFloat timeAgoHeight = self.timeAgo.frame.size.height;
self.timeAgo.frame = CGRectMake(88, tweetHeight, 100, timeAgoHeight + 10.0f);
I have also tried a stringhelper which I found in a tutorial.
The:
- (CGFloat)RAD_textHeightForSystemFontOfSize:(CGFloat)size {
My HeightForRow methods is also already different because I use different cell styles.
At the moment I return a hard value for each cell style but that also needs to change to the cellheight.
See this tutorial, http://www.cimgf.com/2009/09/23/uitableviewcell-dynamic-height/
The trick is to make the label grow with the size of the cell, than you can just set the size of the cell and the cell will grow with it.
Set the timeAgo label to align it self to the bottom of the cell.
Set the numberOfLines of tweet to 0 via IB,re move all the draw code and only implement the following:
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
id item = [self.item objectAtIndex:indexpath.row];
CGFloat height = 85.0f;
if ([item isKindOfClass:[Tweet class]]) {
Tweet *tweet = (Tweet *)item;
CGSize titleSize = [tweet.tweet sizeWithFont:[UIFont fontWithName:#"Arial" size:13.0f] constrainedToSize:CGSizeMake(260.0f, MAXFLOAT)];
// adde the 24 pixels to get the height plus the time ago label.
height = titleSize.height + 24.0f;
} else if( [item isKinfOfClass:[SC_Release class]]) {
height = 65.0f;
}
return height;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *string = [tweetsArray indexPath.row];
CGSize labelSize = [string sizeWithFont:[UIFont fontWithName:#"Verdana" size:17.0]
constrainedToSize:CGSizeMake(280.0f, MAXFLOAT)
lineBreakMode:UILineBreakModeWordWrap];
return labelSize.height + 20;
}