feat:rename vlayout and hlayout
This commit is contained in:
@@ -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 <UIView *(^)()> *blocks) {
|
||||
VLayout *layout = [[VLayout alloc] initWithFrame:CGRectZero];
|
||||
DoricVLayoutView *vLayoutWithBlock(NSArray <UIView *(^)()> *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 <UIView *(^)()> *blocks) {
|
||||
HLayout *layout = [[HLayout alloc] initWithFrame:CGRectZero];
|
||||
DoricHLayoutView *hLayoutWithBlock(NSArray <UIView *(^)()> *blocks) {
|
||||
DoricHLayoutView *layout = [[DoricHLayoutView alloc] initWithFrame:CGRectZero];
|
||||
UIView *(^block)();
|
||||
for (block in blocks) {
|
||||
[layout addSubview:block()];
|
||||
|
||||
Reference in New Issue
Block a user