iOS:fix NestedScroll
This commit is contained in:
parent
a9608506f5
commit
8e6b4dd024
@ -139,6 +139,7 @@ - (void)blendHeader {
|
||||
}
|
||||
|
||||
- (void)requestLayout {
|
||||
[self.contentNode requestLayout];
|
||||
[self.view.headerView.doricLayout apply:self.view.frame.size];
|
||||
self.view.headerView.bottom = 0;
|
||||
self.view.headerView.centerX = self.view.width / 2;
|
||||
|
@ -25,6 +25,8 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricGroupNode <V:UIView *> : DoricSuperNode<V>
|
||||
@property(nonatomic, copy) NSArray<DoricViewNode *> *childNodes;
|
||||
@property(nonatomic, copy) NSArray <NSString *> *childViewIds;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -22,11 +22,6 @@
|
||||
|
||||
#import "DoricGroupNode.h"
|
||||
|
||||
@interface DoricGroupNode ()
|
||||
@property(nonatomic, copy) NSArray<DoricViewNode *> *childNodes;
|
||||
@property(nonatomic, copy) NSArray <NSString *> *childViewIds;
|
||||
@end
|
||||
|
||||
@implementation DoricGroupNode
|
||||
|
||||
- (instancetype)initWithContext:(DoricContext *)doricContext {
|
||||
|
@ -36,6 +36,7 @@ - (void)initWithSuperNode:(DoricSuperNode *)superNode {
|
||||
}
|
||||
|
||||
- (void)requestLayout {
|
||||
[super requestLayout];
|
||||
[self.view.doricLayout apply];
|
||||
}
|
||||
@end
|
||||
|
@ -25,27 +25,6 @@ @interface DoricNestedSliderView : UIScrollView
|
||||
@end
|
||||
|
||||
@implementation DoricNestedSliderView
|
||||
//- (CGSize)sizeThatFits:(CGSize)size {
|
||||
// if (self.subviews.count > 0) {
|
||||
// CGFloat width = size.width;
|
||||
// CGFloat height = size.height;
|
||||
// for (UIView *child in self.subviews) {
|
||||
// CGSize childSize = [child measureSize:size];
|
||||
// width = MAX(childSize.width, width);
|
||||
// height = MAX(childSize.height, height);
|
||||
// }
|
||||
// return CGSizeMake(width, height);
|
||||
// }
|
||||
// return size;
|
||||
//}
|
||||
//
|
||||
//- (void)layoutSelf:(CGSize)targetSize {
|
||||
// [super layoutSelf:targetSize];
|
||||
// [self.subviews forEachIndexed:^(__kindof UIView *obj, NSUInteger idx) {
|
||||
// obj.left = idx * self.width;
|
||||
// }];
|
||||
// [self setContentSize:CGSizeMake(self.subviews.count * self.width, self.height)];
|
||||
//}
|
||||
@end
|
||||
|
||||
@interface DoricNestedSliderNode () <UIScrollViewDelegate>
|
||||
@ -85,6 +64,13 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
||||
self.lastPosition = pageIndex;
|
||||
}
|
||||
|
||||
- (void)requestLayout {
|
||||
[self.childNodes forEachIndexed:^(DoricViewNode *node, NSUInteger idx) {
|
||||
[node.view.doricLayout apply:self.view.frame.size];
|
||||
node.view.left = idx * self.view.width;
|
||||
}];
|
||||
self.view.contentSize = CGSizeMake(self.childNodes.count * self.view.width, self.view.height);
|
||||
}
|
||||
|
||||
- (void)slidePage:(NSDictionary *)params withPromise:(DoricPromise *)promise {
|
||||
NSUInteger pageIndex = [params[@"page"] unsignedIntegerValue];
|
||||
|
@ -120,6 +120,7 @@ - (void)afterBlended:(NSDictionary *)props {
|
||||
}
|
||||
|
||||
- (void)requestLayout {
|
||||
[self.childNode requestLayout];
|
||||
[self.view.contentView.doricLayout apply:self.view.frame.size];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user