feat:step 4
This commit is contained in:
parent
1dabccbe50
commit
91a26eb9a8
@ -94,17 +94,8 @@ - (CGSize)measureSize:(CGSize)targetSize {
|
|||||||
* layout self and subviews
|
* layout self and subviews
|
||||||
* */
|
* */
|
||||||
- (void)layoutSelf:(CGSize)targetSize {
|
- (void)layoutSelf:(CGSize)targetSize {
|
||||||
CGSize contentSize = [self sizeThatFits:targetSize];
|
self.width = targetSize.width;
|
||||||
if (self.layoutConfig.widthSpec == DoricLayoutAtMost) {
|
self.height = targetSize.height;
|
||||||
self.width = targetSize.width;
|
|
||||||
} else if (self.layoutConfig.widthSpec == DoricLayoutWrapContent) {
|
|
||||||
self.width = contentSize.width;
|
|
||||||
}
|
|
||||||
if (self.layoutConfig.heightSpec == DoricLayoutAtMost) {
|
|
||||||
self.height = targetSize.height;
|
|
||||||
} else if (self.layoutConfig.heightSpec == DoricLayoutWrapContent) {
|
|
||||||
self.height = contentSize.height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)requestSuperview {
|
- (BOOL)requestSuperview {
|
||||||
@ -167,6 +158,10 @@ @interface DoricLayoutContainer ()
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation DoricLayoutContainer
|
@implementation DoricLayoutContainer
|
||||||
|
- (void)setNeedsLayout {
|
||||||
|
[super setNeedsLayout];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)layoutSubviews {
|
- (void)layoutSubviews {
|
||||||
[super layoutSubviews];
|
[super layoutSubviews];
|
||||||
[self doricLayoutSubviews];
|
[self doricLayoutSubviews];
|
||||||
@ -294,8 +289,6 @@ - (CGSize)sizeThatFits:(CGSize)size {
|
|||||||
|
|
||||||
- (void)layoutSelf:(CGSize)targetSize {
|
- (void)layoutSelf:(CGSize)targetSize {
|
||||||
[super layoutSelf:targetSize];
|
[super layoutSelf:targetSize];
|
||||||
self.width = targetSize.width;
|
|
||||||
self.height = targetSize.height;
|
|
||||||
CGFloat yStart = 0;
|
CGFloat yStart = 0;
|
||||||
if ((self.gravity & TOP) == TOP) {
|
if ((self.gravity & TOP) == TOP) {
|
||||||
yStart = 0;
|
yStart = 0;
|
||||||
|
@ -41,9 +41,14 @@ - (CGSize)sizeThatFits:(CGSize)size {
|
|||||||
|
|
||||||
- (void)layoutSelf:(CGSize)targetSize {
|
- (void)layoutSelf:(CGSize)targetSize {
|
||||||
[super layoutSelf:targetSize];
|
[super layoutSelf:targetSize];
|
||||||
[self.contentView layoutSelf: [self.contentView sizeThatFits:targetSize]];
|
[self.contentView layoutSelf:[self.contentView sizeThatFits:targetSize]];
|
||||||
[self setContentSize:self.contentView.frame.size];
|
[self setContentSize:self.contentView.frame.size];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (CGSize)measureSize:(CGSize)targetSize {
|
||||||
|
CGSize size = [super measureSize:targetSize];
|
||||||
|
return CGSizeMake(MIN(targetSize.width, size.width), MIN(targetSize.height, size.height));
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface DoricScrollerNode ()
|
@interface DoricScrollerNode ()
|
||||||
|
Reference in New Issue
Block a user