it has some error add demo file 'TestViewController.m' when convert to ‘TestViewController.m.log’
the code:
//
// TestViewController.m
// TestUITextView
//
// Created by xxx on 2022/6/8.
//
#import "TestViewController.h"
#import "TestTableViewCell.h"
#import "TestModel.h"
@interface TestViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic , strong) NSMutableArray *datas;
@end
@implementation TestViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.tableView registerClass:[TestTableViewCell class] forCellReuseIdentifier:@"TestTableViewCell"];
[self loadData];
}
- (void)loadData
{
self.datas = [[NSMutableArray alloc] init];
NSString *test = @"testabcdefg";
for (NSInteger i = 0; i < 100; i++) {
NSMutableString *text = [[NSMutableString alloc] init];
[text appendFormat:@"%@ ",@(i)];
NSInteger k = i;
if (k > 10) k = k%10;
for (NSInteger j = 0;j<k;j++) {
[text appendString:test];
}
TestModel *model = [[TestModel alloc] initWithText:text];
[self.datas addObject:model];
}
[self.tableView reloadData];
}
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
TestTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TestTableViewCell"];
TestModel *model = self.datas[indexPath.row];
[cell bindModel:model];
return cell;
}
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datas.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
TestModel *model = self.datas[indexPath.row];
return model.size.height;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
@end
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: