TCChatCell.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // Copyright 2012 Square Inc.
  3. // Portions Copyright (c) 2016-present, Facebook, Inc.
  4. // All rights reserved.
  5. //
  6. // This source code is licensed under the license found in the
  7. // LICENSE-examples file in the root directory of this source tree.
  8. //
  9. #import "TCChatCell.h"
  10. @implementation TCChatCell
  11. @synthesize nameLabel = _nameLabel;
  12. @synthesize textView = _textView;
  13. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  14. {
  15. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  16. if (self) {
  17. // Initialization code
  18. }
  19. return self;
  20. }
  21. - (CGSize)sizeThatFits:(CGSize)size;
  22. {
  23. CGSize textViewSize = _textView.bounds.size;
  24. CGSize fitTextViewSize = CGSizeMake(textViewSize.width, size.height);
  25. CGSize sizeThatFitsSize = [self.textView sizeThatFits:fitTextViewSize];
  26. CGSize superSize = [super sizeThatFits:size];
  27. sizeThatFitsSize.height = MAX(superSize.height, sizeThatFitsSize.height);
  28. sizeThatFitsSize.width = superSize.width;
  29. return sizeThatFitsSize;
  30. }
  31. @end