Guest User

Untitled

a guest
Jun 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. - (CGFloat)heightForTweetCellWithString:(NSString *)text {
  2. CGFloat height = Buffer + [text sizeWithFont:Font constrainedToSize:Size lineBreakMode:LineBreakMode].height;
  3. return MAX(height, MinHeight);
  4. }
  5.  
  6. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  7. NSString *text = // get tweet text for this indexpath
  8. return [self heightForTweetCellWithString:text];
  9. }
  10. }
  11.  
  12. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  13. static NSString *CellIdentifier = @"TweetCell";
  14. TweetCell *cell = (TweetCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  15. if (cell == nil) {
  16. cell = [self createNewTweetCellFromNib];
  17. }
  18. cell.tweet.text = // tweet text
  19. // set other labels, etc
  20. return cell;
  21. }
Add Comment
Please, Sign In to add comment