feat:step6

This commit is contained in:
pengfei.zhou 2019-11-27 17:17:03 +08:00
parent 209a9267fe
commit e3cb635358
4 changed files with 20 additions and 6 deletions

View File

@ -96,6 +96,9 @@ - (CGSize)measureSize:(CGSize)targetSize {
- (void)layoutSelf:(CGSize)targetSize {
self.width = targetSize.width;
self.height = targetSize.height;
for (UIView *view in self.subviews) {
[view layoutSelf:[view measureSize:targetSize]];
}
}
- (BOOL)requestSuperview {
@ -202,7 +205,8 @@ - (CGSize)sizeThatFits:(CGSize)size {
}
- (void)layoutSelf:(CGSize)targetSize {
[super layoutSelf:targetSize];
self.width = targetSize.width;
self.height = targetSize.height;
for (UIView *child in self.subviews) {
if (child.isHidden) {
continue;
@ -288,7 +292,8 @@ - (CGSize)sizeThatFits:(CGSize)size {
}
- (void)layoutSelf:(CGSize)targetSize {
[super layoutSelf:targetSize];
self.width = targetSize.width;
self.height = targetSize.height;
CGFloat yStart = 0;
if ((self.gravity & TOP) == TOP) {
yStart = 0;
@ -378,7 +383,8 @@ - (CGSize)sizeThatFits:(CGSize)size {
}
- (void)layoutSelf:(CGSize)targetSize {
[super layoutSelf:targetSize];
self.width = targetSize.width;
self.height = targetSize.height;
CGFloat xStart = 0;
if (self.contentWeight) {
xStart = 0;

View File

@ -41,7 +41,6 @@ - (CGSize)sizeThatFits:(CGSize)size {
- (void)layoutSelf:(CGSize)targetSize {
[super layoutSelf:targetSize];
[self.contentView layoutSelf:[self.contentView sizeThatFits:targetSize]];
[self setContentSize:self.contentView.frame.size];
}

View File

@ -25,6 +25,9 @@ @interface DoricSlideItemView : DoricStackView
@end
@implementation DoricSlideItemView
- (void)layoutSubviews {
[super layoutSubviews];
}
@end
@implementation DoricSlideItemNode

View File

@ -45,12 +45,18 @@ - (CGSize)sizeThatFits:(CGSize)size {
if (self.subviews.count > 0) {
CGFloat height = size.height;
for (UIView *child in self.subviews) {
height = MAX(child.height, height);
CGSize childSize = [child measureSize:size];
height = MAX(childSize.height, height);
}
return CGSizeMake(height, size.height);
return CGSizeMake(size.width, size.height);
}
return size;
}
- (void)layoutSelf:(CGSize)targetSize {
[super layoutSelf:targetSize];
[self reloadData];
}
@end
@implementation DoricSliderNode