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

View File

@ -35,24 +35,6 @@ @interface DoricTableView : UITableView
@end @end
@implementation DoricTableView @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 @end
@ -153,14 +135,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
DoricListItemNode *listItemNode = [[DoricListItemNode alloc] initWithContext:self.doricContext]; DoricListItemNode *listItemNode = [[DoricListItemNode alloc] initWithContext:self.doricContext];
[listItemNode initWithSuperNode:self]; [listItemNode initWithSuperNode:self];
cell.doricListItemNode = listItemNode; cell.doricListItemNode = listItemNode;
listItemNode.view.width = tableView.width;
[cell.contentView addSubview:listItemNode.view]; [cell.contentView addSubview:listItemNode.view];
} }
DoricListItemNode *node = cell.doricListItemNode; DoricListItemNode *node = cell.doricListItemNode;
node.viewId = model[@"id"]; node.viewId = model[@"id"];
[node blend:props]; [node blend:props];
// CGSize size = [node.view measureSize:CGSizeMake(tableView.width, tableView.height)]; [self callItem:position height:node.view.height];
// [node.view layoutSelf:size];
// [self callItem:position height:size.height];
return cell; return cell;
} }