From c9f1f099ae5318c719258487487f7c1c83a4f342 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Wed, 23 Oct 2019 20:11:24 +0800 Subject: [PATCH] feat:rename vlayout and hlayout --- iOS/Pod/Classes/Shader/DoricHLayoutNode.h | 2 +- iOS/Pod/Classes/Shader/DoricHLayoutNode.m | 8 +++--- iOS/Pod/Classes/Shader/DoricLayouts.h | 16 +++-------- iOS/Pod/Classes/Shader/DoricLayouts.m | 34 +++++++++++------------ iOS/Pod/Classes/Shader/DoricStackNode.m | 2 +- iOS/Pod/Classes/Shader/DoricVLayoutNode.h | 2 +- iOS/Pod/Classes/Shader/DoricVLayoutNode.m | 8 +++--- 7 files changed, 32 insertions(+), 40 deletions(-) diff --git a/iOS/Pod/Classes/Shader/DoricHLayoutNode.h b/iOS/Pod/Classes/Shader/DoricHLayoutNode.h index 4e754d28..4f6d6086 100644 --- a/iOS/Pod/Classes/Shader/DoricHLayoutNode.h +++ b/iOS/Pod/Classes/Shader/DoricHLayoutNode.h @@ -22,5 +22,5 @@ #import "DoricGroupNode.h" -@interface DoricHLayoutNode : DoricGroupNode +@interface DoricHLayoutNode : DoricGroupNode @end diff --git a/iOS/Pod/Classes/Shader/DoricHLayoutNode.m b/iOS/Pod/Classes/Shader/DoricHLayoutNode.m index de2f0c00..5292ae4d 100644 --- a/iOS/Pod/Classes/Shader/DoricHLayoutNode.m +++ b/iOS/Pod/Classes/Shader/DoricHLayoutNode.m @@ -24,11 +24,11 @@ #import "DoricUtil.h" @implementation DoricHLayoutNode -- (HLayout *)build:(NSDictionary *)props { - return [HLayout new]; +- (DoricHLayoutView *)build:(NSDictionary *)props { + return [DoricHLayoutView new]; } -- (void)blendView:(HLayout *)view forPropName:(NSString *)name propValue:(id)prop { +- (void)blendView:(DoricHLayoutView *)view forPropName:(NSString *)name propValue:(id)prop { if ([name isEqualToString:@"gravity"]) { view.gravity = (DoricGravity) [(NSNumber *) prop integerValue]; } else if ([name isEqualToString:@"space"]) { @@ -41,7 +41,7 @@ - (void)blendView:(HLayout *)view forPropName:(NSString *)name propValue:(id)pro - (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig { [super blendChild:child layoutConfig:layoutConfig]; if (![child.layoutConfig isKindOfClass:DoricLinearConfig.class]) { - DoricLog(@"blend HLayout child error,layout params not match"); + DoricLog(@"blend DoricHLayoutView child error,layout params not match"); return; } DoricLinearConfig *params = (DoricLinearConfig *) child.layoutConfig; diff --git a/iOS/Pod/Classes/Shader/DoricLayouts.h b/iOS/Pod/Classes/Shader/DoricLayouts.h index 421b27b3..8b825e6f 100644 --- a/iOS/Pod/Classes/Shader/DoricLayouts.h +++ b/iOS/Pod/Classes/Shader/DoricLayouts.h @@ -89,29 +89,21 @@ typedef NS_ENUM(NSInteger, DoricGravity) { @property(nonatomic, assign) DoricGravity gravity; @end -@interface LinearLayout : DoricLayoutContainer +@interface DoricLinearView : DoricLayoutContainer @property(nonatomic, assign) DoricGravity gravity; @property(nonatomic, assign) CGFloat space; @end -@interface VLayout : LinearLayout +@interface DoricVLayoutView : DoricLinearView @end -@interface HLayout : LinearLayout +@interface DoricHLayoutView : DoricLinearView @end -@interface UIView (LayoutConfig) +@interface UIView (DoricLayoutConfig) @property(nonatomic, strong) DoricLayoutConfig *layoutConfig; @property(nonatomic, copy) NSString *tagString; - (UIView *)viewWithTagString:(NSString *)tagString; @end - -VLayout *vLayout(NSArray <__kindof UIView *> *views); - -HLayout *hLayout(NSArray <__kindof UIView *> *views); - -VLayout *vLayoutWithBlock(NSArray *blocks); - -HLayout *hLayoutWithBlock(NSArray *blocks); diff --git a/iOS/Pod/Classes/Shader/DoricLayouts.m b/iOS/Pod/Classes/Shader/DoricLayouts.m index f8d67ce3..2a6777d6 100644 --- a/iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/iOS/Pod/Classes/Shader/DoricLayouts.m @@ -107,8 +107,8 @@ - (DoricLayoutConfig *)configForChild:(UIView *)child { } - (void)requestLayout { - if ([self.superview isKindOfClass:[LinearLayout class]]) { - [(LinearLayout *) self.superview requestLayout]; + if ([self.superview isKindOfClass:[DoricLinearView class]]) { + [(DoricLinearView *) self.superview requestLayout]; return; } if (self.waitingLayout) { @@ -218,13 +218,13 @@ - (void)layout { } @end -@interface LinearLayout () +@interface DoricLinearView () @property(nonatomic, assign) CGFloat contentWidth; @property(nonatomic, assign) CGFloat contentHeight; @property(nonatomic, assign) NSUInteger contentWeight; @end -@implementation LinearLayout +@implementation DoricLinearView - (DoricLinearConfig *)configForChild:(UIView *)child { DoricLinearConfig *config = (DoricLinearConfig *) child.layoutConfig; if (!config) { @@ -234,7 +234,7 @@ - (DoricLinearConfig *)configForChild:(UIView *)child { } @end -@implementation VLayout +@implementation DoricVLayoutView - (void)sizeToFit { DoricLayoutConfig *config = self.layoutConfig; @@ -330,11 +330,11 @@ - (void)layout { } @end -@implementation HLayout +@implementation DoricHLayoutView - (void)sizeToFit { DoricLinearConfig *config; - if ([self.superview isKindOfClass:[LinearLayout class]]) { - config = [(LinearLayout *) self.superview configForChild:self]; + if ([self.superview isKindOfClass:[DoricLinearView class]]) { + config = [(DoricLinearView *) self.superview configForChild:self]; } else { config = (DoricLinearConfig *) self.layoutConfig; if (!config) { @@ -438,7 +438,7 @@ - (void)layout { static const void *kLayoutConfig = &kLayoutConfig; static const void *kTagString = &kTagString; -@implementation UIView (LayoutConfig) +@implementation UIView (DoricLayoutConfig) @dynamic layoutConfig; - (void)setLayoutConfig:(DoricLayoutConfig *)layoutConfig { @@ -466,8 +466,8 @@ - (UIView *)viewWithTagString:(NSString *)tagString { @end -VLayout *vLayout(NSArray <__kindof UIView *> *views) { - VLayout *layout = [[VLayout alloc] initWithFrame:CGRectZero]; +DoricVLayoutView *vLayout(NSArray <__kindof UIView *> *views) { + DoricVLayoutView *layout = [[DoricVLayoutView alloc] initWithFrame:CGRectZero]; for (__kindof UIView *uiView in views) { [layout addSubview:uiView]; } @@ -475,8 +475,8 @@ - (UIView *)viewWithTagString:(NSString *)tagString { return layout; } -HLayout *hLayout(NSArray <__kindof UIView *> *views) { - HLayout *layout = [[HLayout alloc] initWithFrame:CGRectZero]; +DoricHLayoutView *hLayout(NSArray <__kindof UIView *> *views) { + DoricHLayoutView *layout = [[DoricHLayoutView alloc] initWithFrame:CGRectZero]; for (__kindof UIView *uiView in views) { [layout addSubview:uiView]; } @@ -484,8 +484,8 @@ - (UIView *)viewWithTagString:(NSString *)tagString { return layout; } -VLayout *vLayoutWithBlock(NSArray *blocks) { - VLayout *layout = [[VLayout alloc] initWithFrame:CGRectZero]; +DoricVLayoutView *vLayoutWithBlock(NSArray *blocks) { + DoricVLayoutView *layout = [[DoricVLayoutView alloc] initWithFrame:CGRectZero]; UIView *(^block)(); for (block in blocks) { [layout addSubview:block()]; @@ -494,8 +494,8 @@ - (UIView *)viewWithTagString:(NSString *)tagString { return layout; } -HLayout *hLayoutWithBlock(NSArray *blocks) { - HLayout *layout = [[HLayout alloc] initWithFrame:CGRectZero]; +DoricHLayoutView *hLayoutWithBlock(NSArray *blocks) { + DoricHLayoutView *layout = [[DoricHLayoutView alloc] initWithFrame:CGRectZero]; UIView *(^block)(); for (block in blocks) { [layout addSubview:block()]; diff --git a/iOS/Pod/Classes/Shader/DoricStackNode.m b/iOS/Pod/Classes/Shader/DoricStackNode.m index ec1e37af..c260248f 100644 --- a/iOS/Pod/Classes/Shader/DoricStackNode.m +++ b/iOS/Pod/Classes/Shader/DoricStackNode.m @@ -44,7 +44,7 @@ - (DoricStackConfig *)generateDefaultLayoutParams { - (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig { [super blendChild:child layoutConfig:layoutConfig]; if (![child.layoutConfig isKindOfClass:DoricStackConfig.class]) { - DoricLog(@"blend HLayout child error,layout params not match"); + DoricLog(@"blend DoricHLayoutView child error,layout params not match"); return; } DoricStackConfig *params = (DoricStackConfig *) child.layoutConfig; diff --git a/iOS/Pod/Classes/Shader/DoricVLayoutNode.h b/iOS/Pod/Classes/Shader/DoricVLayoutNode.h index 28cde7d3..6024eaa2 100644 --- a/iOS/Pod/Classes/Shader/DoricVLayoutNode.h +++ b/iOS/Pod/Classes/Shader/DoricVLayoutNode.h @@ -22,5 +22,5 @@ #import "DoricGroupNode.h" -@interface DoricVLayoutNode : DoricGroupNode +@interface DoricVLayoutNode : DoricGroupNode @end diff --git a/iOS/Pod/Classes/Shader/DoricVLayoutNode.m b/iOS/Pod/Classes/Shader/DoricVLayoutNode.m index 243b04fd..7b586e4c 100644 --- a/iOS/Pod/Classes/Shader/DoricVLayoutNode.m +++ b/iOS/Pod/Classes/Shader/DoricVLayoutNode.m @@ -25,11 +25,11 @@ @implementation DoricVLayoutNode -- (VLayout *)build:(NSDictionary *)props { - return [VLayout new]; +- (DoricVLayoutView *)build:(NSDictionary *)props { + return [DoricVLayoutView new]; } -- (void)blendView:(VLayout *)view forPropName:(NSString *)name propValue:(id)prop { +- (void)blendView:(DoricVLayoutView *)view forPropName:(NSString *)name propValue:(id)prop { if ([name isEqualToString:@"gravity"]) { view.gravity = (DoricGravity) [(NSNumber *) prop integerValue]; } else if ([name isEqualToString:@"space"]) { @@ -42,7 +42,7 @@ - (void)blendView:(VLayout *)view forPropName:(NSString *)name propValue:(id)pro - (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutconfig { [super blendChild:child layoutConfig:layoutconfig]; if (![child.layoutConfig isKindOfClass:DoricLinearConfig.class]) { - DoricLog(@"blend VLayout child error,layout params not match"); + DoricLog(@"blend DoricVLayoutView child error,layout params not match"); return; } DoricLinearConfig *params = (DoricLinearConfig *) child.layoutConfig;