feat:step 11

This commit is contained in:
pengfei.zhou 2019-11-27 18:32:59 +08:00
parent d8a743f13f
commit ea8ea4a8ff
2 changed files with 4 additions and 9 deletions

View File

@ -274,9 +274,6 @@ - (CGSize)sizeThatFits:(CGSize)size {
CGSize childSize; CGSize childSize;
if (CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) { if (CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
childSize = [child measureSize:CGSizeMake(size.width, size.height - contentHeight)]; childSize = [child measureSize:CGSizeMake(size.width, size.height - contentHeight)];
if (childConfig.weight) {
childSize.height = child.height;
}
} else { } else {
childSize = child.bounds.size; childSize = child.bounds.size;
} }
@ -320,7 +317,7 @@ - (void)layoutSelf:(CGSize)targetSize {
CGSize size = [child measureSize:CGSizeMake(targetSize.width, targetSize.height - yStart)]; CGSize size = [child measureSize:CGSizeMake(targetSize.width, targetSize.height - yStart)];
if (childConfig.weight) { if (childConfig.weight) {
size.height = child.height + remain / self.contentWeight * childConfig.weight; size.height += remain / self.contentWeight * childConfig.weight;
} }
[child layoutSelf:size]; [child layoutSelf:size];
DoricGravity gravity = childConfig.alignment | self.gravity; DoricGravity gravity = childConfig.alignment | self.gravity;
@ -365,9 +362,6 @@ - (CGSize)sizeThatFits:(CGSize)size {
CGSize childSize; CGSize childSize;
if (CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) { if (CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
childSize = [child measureSize:CGSizeMake(size.width - contentWidth, size.height)]; childSize = [child measureSize:CGSizeMake(size.width - contentWidth, size.height)];
if (childConfig.weight) {
childSize.width = child.width;
}
} else { } else {
childSize = child.bounds.size; childSize = child.bounds.size;
} }
@ -413,7 +407,7 @@ - (void)layoutSelf:(CGSize)targetSize {
CGSize size = [child measureSize:CGSizeMake(targetSize.width - xStart, targetSize.height)]; CGSize size = [child measureSize:CGSizeMake(targetSize.width - xStart, targetSize.height)];
if (childConfig.weight) { if (childConfig.weight) {
size.width = child.width + remain / self.contentWeight * childConfig.weight; size.width += remain / self.contentWeight * childConfig.weight;
} }
[child layoutSelf:size]; [child layoutSelf:size];

View File

@ -128,7 +128,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
DoricSlideItemNode *node = cell.doricSlideItemNode; DoricSlideItemNode *node = cell.doricSlideItemNode;
node.viewId = model[@"id"]; node.viewId = model[@"id"];
[node blend:props]; [node blend:props];
[node.view setNeedsLayout]; CGSize size = [node.view measureSize:CGSizeMake(collectionView.width, collectionView.height)];
[node.view layoutSelf:size];
return cell; return cell;
} }