iOS: Fix layout in flowlayout or list
This commit is contained in:
parent
1dc167a43c
commit
0df882f28c
@ -486,12 +486,9 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
|||||||
if (props[@"fullSpan"]) {
|
if (props[@"fullSpan"]) {
|
||||||
fullSpan = [props[@"fullSpan"] boolValue];
|
fullSpan = [props[@"fullSpan"] boolValue];
|
||||||
}
|
}
|
||||||
if (fullSpan) {
|
CGFloat width = fullSpan ? collectionView.width : (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount;
|
||||||
node.view.width = collectionView.width;
|
CGFloat height = node.view.doricLayout.heightSpec == DoricLayoutFit ? CGFLOAT_MAX : collectionView.height;
|
||||||
} else {
|
[node.view.doricLayout apply:CGSizeMake(width, height)];
|
||||||
node.view.width = (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount;
|
|
||||||
}
|
|
||||||
[node.view.doricLayout apply];
|
|
||||||
[node requestLayout];
|
[node requestLayout];
|
||||||
[self callItem:position size:node.view.frame.size];
|
[self callItem:position size:node.view.frame.size];
|
||||||
return cell;
|
return cell;
|
||||||
|
@ -266,7 +266,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
|||||||
DoricHorizontalListItemNode *node = cell.doricHorizontalListItemNode;
|
DoricHorizontalListItemNode *node = cell.doricHorizontalListItemNode;
|
||||||
node.viewId = model[@"id"];
|
node.viewId = model[@"id"];
|
||||||
[node blend:props];
|
[node blend:props];
|
||||||
[node.view.doricLayout apply:CGSizeMake(collectionView.width, collectionView.height)];
|
CGFloat width = node.view.doricLayout.widthSpec == DoricLayoutFit ? CGFLOAT_MAX : collectionView.width;
|
||||||
|
[node.view.doricLayout apply:CGSizeMake(width, collectionView.height)];
|
||||||
[node requestLayout];
|
[node requestLayout];
|
||||||
[self callItem:position width:node.view.width];
|
[self callItem:position width:node.view.width];
|
||||||
return cell;
|
return cell;
|
||||||
|
@ -268,7 +268,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
|
|||||||
DoricListItemNode *node = cell.doricListItemNode;
|
DoricListItemNode *node = cell.doricListItemNode;
|
||||||
node.viewId = model[@"id"];
|
node.viewId = model[@"id"];
|
||||||
[node blend:props];
|
[node blend:props];
|
||||||
[node.view.doricLayout apply:CGSizeMake(tableView.width, tableView.height)];
|
CGFloat height = node.view.doricLayout.heightSpec == DoricLayoutFit ? CGFLOAT_MAX : tableView.height;
|
||||||
|
[node.view.doricLayout apply:CGSizeMake(tableView.width, height)];
|
||||||
[node requestLayout];
|
[node requestLayout];
|
||||||
[self callItem:position height:node.view.height];
|
[self callItem:position height:node.view.height];
|
||||||
return cell;
|
return cell;
|
||||||
|
Reference in New Issue
Block a user