feat:add SwipeLayout
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#import "DoricLayouts.h"
|
||||
#import <objc/runtime.h>
|
||||
#import "UIView+Doric.h"
|
||||
#import "Doric.h"
|
||||
|
||||
DoricMargin DoricMarginMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom) {
|
||||
DoricMargin margin;
|
||||
@@ -537,6 +538,13 @@ - (void)layoutSelf {
|
||||
} else if (self.layoutConfig.heightSpec == DoricLayoutWrapContent) {
|
||||
self.height = contentSize.height;
|
||||
}
|
||||
[self.subviews forEach:^(__kindof UIView *obj) {
|
||||
if ([obj isKindOfClass:[DoricLayoutContainer class]]) {
|
||||
[obj layoutSubviews];
|
||||
} else {
|
||||
[obj layoutSelf];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@end
|
||||
|
||||
|
@@ -32,12 +32,6 @@ - (void)setContentView:(UIView *)contentView {
|
||||
[self addSubview:contentView];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
[self layoutSelf];
|
||||
[self.contentView layoutSubviews];
|
||||
}
|
||||
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
if (self.contentView) {
|
||||
CGSize childSize = [self.contentView sizeThatFits:size];
|
||||
@@ -92,15 +86,19 @@ - (void)blend:(NSDictionary *)props {
|
||||
self.view.contentView = it.view;
|
||||
}];
|
||||
}
|
||||
[self.view also:^(DoricScrollView *it) {
|
||||
if (it.contentView) {
|
||||
CGSize size = [it.contentView sizeThatFits:it.frame.size];
|
||||
[it setContentSize:size];
|
||||
}
|
||||
}];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.view also:^(DoricScrollView *it) {
|
||||
[it layoutSelf];
|
||||
if (it.contentView) {
|
||||
CGSize size = [it.contentView sizeThatFits:it.frame.size];
|
||||
[it setContentSize:size];
|
||||
}
|
||||
[it layoutSelf];
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)blendView:(UIScrollView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||
- (void)blendView:(DoricScrollView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||
if ([@"content" isEqualToString:name]) {
|
||||
self.childViewId = prop;
|
||||
} else {
|
||||
@@ -111,4 +109,4 @@ - (void)blendView:(UIScrollView *)view forPropName:(NSString *)name propValue:(i
|
||||
- (void)blendSubNode:(NSDictionary *)subModel {
|
||||
[self.childNode blend:subModel[@"props"]];
|
||||
}
|
||||
@end
|
||||
@end
|
||||
|
Reference in New Issue
Block a user