Hee all,
I have created a UITableViewCell with a NIB file. There is 1 label in it wich 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 wich 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.
Hope you guys can point me in a good direction.
Thanks,
- Rolf