iOS:fix List

This commit is contained in:
pengfei.zhou 2020-04-03 19:09:40 +08:00 committed by osborn
parent eb78e3e201
commit 102f570fb4
2 changed files with 4 additions and 31 deletions

View File

@ -18,18 +18,10 @@
//
#import "DoricListItemNode.h"
#import "DoricExtensions.h"
@interface DoricListItemNode ()
@end
@interface DoricListItemView : UIView
@end
@implementation DoricListItemView
@end
@implementation DoricListItemNode
- (instancetype)initWithContext:(DoricContext *)doricContext {
if (self = [super initWithContext:doricContext]) {
@ -43,7 +35,7 @@ - (void)initWithSuperNode:(DoricSuperNode *)superNode {
self.reusable = YES;
}
- (DoricListItemView *)build {
return [DoricListItemView new];
- (void)requestLayout {
[self.view.doricLayout apply];
}
@end

View File

@ -35,24 +35,6 @@ @interface DoricTableView : UITableView
@end
@implementation DoricTableView
//- (CGSize)sizeThatFits:(CGSize)size {
// if (self.subviews.count > 0) {
// CGFloat width = size.width;
// CGFloat height = 0;
//
// for (UIView *child in self.subviews) {
// CGSize childSize = [child measureSize:size];
// width = MAX(childSize.width, width);
// height += childSize.height;
// }
// return CGSizeMake(width, MAX(height, size.height));
// }
// return size;
//}
//
//- (void)layoutSelf:(CGSize)targetSize {
// [super layoutSelf:targetSize];
//}
@end
@ -153,14 +135,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
DoricListItemNode *listItemNode = [[DoricListItemNode alloc] initWithContext:self.doricContext];
[listItemNode initWithSuperNode:self];
cell.doricListItemNode = listItemNode;
listItemNode.view.width = tableView.width;
[cell.contentView addSubview:listItemNode.view];
}
DoricListItemNode *node = cell.doricListItemNode;
node.viewId = model[@"id"];
[node blend:props];
// CGSize size = [node.view measureSize:CGSizeMake(tableView.width, tableView.height)];
// [node.view layoutSelf:size];
// [self callItem:position height:size.height];
[self callItem:position height:node.view.height];
return cell;
}