feat:change moment of setting scrollview's contentsize

This commit is contained in:
pengfei.zhou 2019-11-26 15:51:39 +08:00
parent 0b1174c3fd
commit 08e42bacdd

View File

@ -29,10 +29,6 @@ @implementation DoricScrollView
- (void)layoutSubviews { - (void)layoutSubviews {
[super layoutSubviews]; [super layoutSubviews];
if (self.subviews.count > 0) {
UIView *child = self.subviews[0];
[self setContentSize:child.frame.size];
}
} }
- (CGSize)sizeThatFits:(CGSize)size { - (CGSize)sizeThatFits:(CGSize)size {
@ -91,6 +87,13 @@ - (void)blend:(NSDictionary *)props {
[self.view addSubview:it.view]; [self.view addSubview:it.view];
}]; }];
} }
[self.view also:^(UIScrollView *it) {
if (it.subviews.count > 0) {
UIView *child = it.subviews[0];
CGSize size = [child sizeThatFits:it.frame.size];
[it setContentSize:size];
}
}];
} }
- (void)blendView:(UIScrollView *)view forPropName:(NSString *)name propValue:(id)prop { - (void)blendView:(UIScrollView *)view forPropName:(NSString *)name propValue:(id)prop {