iphone - UITableViewCell dynamic height :/ -
O All,
I have created a UITableViewCell with an NIB file. It has 1 label that contains a tweet. So it needs a dynamic height that is also a time label that has to fit under the label.
I am trying to stuff things with the frame frame, but I can not find the right solution .. I remove it in the UTable watch file.
self.tweet.lineBreakMode = UILineBreakModeWordWrap; Self.tweet.numberOfLines = 0; Self.tweet.font = [UIFont fontWithName: @ "Arial" Size: 13.0f]; [Self. Tweet size tofitt]; CGFloat TwitterHigh = self.tweet.frame.size.height; Self.timeAgo.lineBreakMode = UILineBreakModeWordWrap; Self.timeAgo.numberOfLines = 0; Self.timeAgo.font = [UIFont fontWithName: @ "Arial" Size: 11.0f]; [Self. Timego shape tofitt]; CGFloat TimeAgeHeight = AutoTimeOgo Frame.ize.height; Self.timeAgo.frame = CGRectMake (88, TwitterWire, 100, TimeAgeHight + 10.0F); I have also tried a string helper in the tutorial.
I use different cell styles. At the moment, I work hard for each cell style, but it has to be changed in cellhete.
Hope you can tell me in a good direction.
Thanks,
- Ralph
Look at this tutorial,
This trick is to create labels with the size of the cell, from this you can do just set the size of the cell and the cell will grow with it.
Set the time to label yourself to align yourself in the lower part of the cell.
Set the number of its Tweets via IB, transfer all the code of the code again and only apply the following:
- (CGFloat) Table view: ( UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath {id items = [self .item object atindexx: indexpath.ro]; CGFloat height = 85.0 f; If ([Item hacked off class: [Color class]]) {Tweet * Tweet = (tweet *) Item; CGSize titleSize = [tweet.tweet sizeWithFont: [UIFont fontWithName: @ "Aile" Size: 13.0 f] Constrained torso: CGSizeMake (260.0F, MaxFlat)]; Add 24 pixels to get height and labels first time. Height = title seasons Hight + 24.0 F; } And if ([item is Confident Class: [SC_Release class]]) {height = 65.0f; } Return height; }
Comments
Post a Comment