iOS:refact requestLayout logic
This commit is contained in:
@@ -31,7 +31,6 @@ @implementation DoricRefreshableNode
|
||||
- (DoricSwipeRefreshLayout *)build {
|
||||
return [[DoricSwipeRefreshLayout new] also:^(DoricSwipeRefreshLayout *it) {
|
||||
it.swipePullingDelegate = self;
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -62,8 +61,7 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)blend:(NSDictionary *)props {
|
||||
[super blend:props];
|
||||
- (void)afterBlended:(NSDictionary *)props {
|
||||
[self blendContent];
|
||||
[self blendHeader];
|
||||
}
|
||||
@@ -102,6 +100,7 @@ - (void)blendContent {
|
||||
self.view.contentView = it.view;
|
||||
}];
|
||||
}
|
||||
[self.view.contentView.doricLayout apply:self.view.frame.size];
|
||||
}
|
||||
|
||||
- (void)blendHeader {
|
||||
@@ -138,6 +137,7 @@ - (void)blendHeader {
|
||||
self.view.headerView = it.view;
|
||||
}];
|
||||
}
|
||||
[self.view.headerView.doricLayout apply:self.view.frame.size];
|
||||
}
|
||||
|
||||
- (void)blendSubNode:(NSDictionary *)subModel {
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#import "DoricSwipeRefreshLayout.h"
|
||||
#import "UIView+Doric.h"
|
||||
#import "DoricLayouts.h"
|
||||
#import "Doric.h"
|
||||
|
||||
@interface DoricSwipeRefreshLayout () <UIScrollViewDelegate>
|
||||
|
||||
@@ -54,41 +53,13 @@ - (instancetype)init {
|
||||
return self;
|
||||
}
|
||||
|
||||
//- (CGSize)sizeThatFits:(CGSize)size {
|
||||
// if (self.contentView) {
|
||||
// return [self.contentView measureSize:size];
|
||||
// }
|
||||
// return CGSizeZero;
|
||||
//}
|
||||
//
|
||||
//- (BOOL)requestFromSubview:(UIView *)subview {
|
||||
// if (subview == self.headerView) {
|
||||
// return NO;
|
||||
// }
|
||||
// return [super requestFromSubview:subview];
|
||||
//}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
if (self.contentView) {
|
||||
return self.contentView.frame.size;
|
||||
}
|
||||
return CGSizeZero;
|
||||
}
|
||||
|
||||
//- (void)layoutSelf:(CGSize)targetSize {
|
||||
// if (self.contentOffset.y != 0) {
|
||||
// return;
|
||||
// }
|
||||
// self.width = targetSize.width;
|
||||
// self.height = targetSize.height;
|
||||
// [self.headerView also:^(UIView *it) {
|
||||
// [it layoutSelf:[it measureSize:targetSize]];
|
||||
// it.bottom = 0;
|
||||
// it.centerX = self.centerX;
|
||||
// }];
|
||||
// [self.contentView also:^(UIView *it) {
|
||||
// [it layoutSelf:targetSize];
|
||||
// }];
|
||||
// self.contentSize = self.frame.size;
|
||||
//}
|
||||
|
||||
- (void)setContentView:(UIView *)contentView {
|
||||
if (_contentView) {
|
||||
[_contentView removeFromSuperview];
|
||||
|
Reference in New Issue
Block a user