iOS:fix FlowLayout show

This commit is contained in:
pengfei.zhou 2020-04-08 11:26:29 +08:00 committed by osborn
parent e4e5103d7b
commit 49df8d4970
2 changed files with 7 additions and 24 deletions

View File

@ -19,16 +19,6 @@
#import "DoricFlowLayoutItemNode.h"
@interface DoricFlowLayoutItemView : UIView
@end
@implementation DoricFlowLayoutItemView
@end
@interface DoricFlowLayoutItemNode ()
@end
@implementation DoricFlowLayoutItemNode
- (instancetype)initWithContext:(DoricContext *)doricContext {
if (self = [super initWithContext:doricContext]) {
@ -41,8 +31,4 @@ - (void)initWithSuperNode:(DoricSuperNode *)superNode {
[super initWithSuperNode:superNode];
self.reusable = YES;
}
- (DoricFlowLayoutItemView *)build {
return [DoricFlowLayoutItemView new];
}
@end

View File

@ -182,7 +182,6 @@ - (UICollectionView *)build {
it.delegate = self;
it.dataSource = self;
[it registerClass:[DoricFlowLayoutViewCell class] forCellWithReuseIdentifier:@"doricCell"];
[it registerClass:[DoricFlowLayoutViewCell class] forCellWithReuseIdentifier:@"doricLoadMoreCell"];
if (@available(iOS 11, *)) {
it.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
@ -318,15 +317,13 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
DoricFlowLayoutItemNode *node = cell.viewNode;
node.viewId = model[@"id"];
[node blend:props];
CGFloat width = (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount;
// CGSize size = [node.view measureSize:CGSizeMake(width, collectionView.height)];
// if (position > 0 && position >= self.itemCount && self.onLoadMoreFuncId) {
// size = CGSizeMake(collectionView.width, size.height);
// [self callJSResponse:self.onLoadMoreFuncId, nil];
// }
//
// [node.view layoutSelf:size];
// [self callItem:position size:size];
node.view.width = (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount;
node.view.height = collectionView.height;
if (position > 0 && position >= self.itemCount && self.onLoadMoreFuncId) {
[self callJSResponse:self.onLoadMoreFuncId, nil];
}
[node.view.doricLayout apply];
[self callItem:position size:node.view.frame.size];
return cell;
}