ios15使用纯代码计算cell的高度
#import "MTableViewController.h"
#import "MTableViewCell.h"
#import "DataModel.h"
static NSString *ID = @"cell";
@interface MTableViewController ()
@property (nonatomic, strong) NSMutableArray *dataSource;
@end
@implementation MTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"cell的高度计算";
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.9];
[self.tableView registerClass:[MTableViewCell class] forCellReuseIdentifier:ID];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *path = [[NSBundle mainBundle] pathForResource:@"cellList.plist" ofType:nil];
NSArray *array = [NSArray arrayWithContentsOfFile:path];
for (NSDictionary *dict in array) {
DataModel *dm = [DataModel initWith:dict];
[self.dataSource addObject:dm];
}
dispatch_async(dispatch_get_main_queue(), ^{