TestChat/TCChatCell.m (22 lines of code) (raw):
//
// Copyright 2012 Square Inc.
// Portions Copyright (c) 2016-present, Facebook, Inc.
// All rights reserved.
//
// This source code is licensed under the license found in the
// LICENSE-examples file in the root directory of this source tree.
//
#import "TCChatCell.h"
@implementation TCChatCell
@synthesize nameLabel = _nameLabel;
@synthesize textView = _textView;
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (CGSize)sizeThatFits:(CGSize)size;
{
CGSize textViewSize = _textView.bounds.size;
CGSize fitTextViewSize = CGSizeMake(textViewSize.width, size.height);
CGSize sizeThatFitsSize = [self.textView sizeThatFits:fitTextViewSize];
CGSize superSize = [super sizeThatFits:size];
sizeThatFitsSize.height = MAX(superSize.height, sizeThatFitsSize.height);
sizeThatFitsSize.width = superSize.width;
return sizeThatFitsSize;
}
@end