From d088e30f3856be81c69fa682e4f9c5594554c482 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Wed, 25 Mar 2020 14:07:24 +0800 Subject: [PATCH] iOS:Text's max width and max height can only be affected while >0 --- doric-iOS/Pod/Classes/Shader/DoricTextNode.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricTextNode.m b/doric-iOS/Pod/Classes/Shader/DoricTextNode.m index d19bce99..56b71832 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricTextNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricTextNode.m @@ -39,10 +39,10 @@ - (CGSize)measureSize:(CGSize)targetSize { CGSize measuredSize = [super measureSize:targetSize]; CGFloat measuredWidth = measuredSize.width; CGFloat measuredHeight = measuredSize.height; - if (self.maxWidth > 0) { + if (self.maxWidth >= 0) { measuredWidth = MIN(self.maxWidth, measuredSize.width); } - if (self.maxHeight > 0) { + if (self.maxHeight >= 0) { measuredHeight = MIN(self.maxHeight, measuredSize.height); } return CGSizeMake(measuredWidth, measuredHeight); @@ -55,8 +55,10 @@ @interface DoricTextNode () @implementation DoricTextNode - (UILabel *)build { - return [[[DoricTextView alloc] init] also:^(UILabel *it) { + return [[[DoricTextView alloc] init] also:^(DoricTextView *it) { it.textAlignment = NSTextAlignmentCenter; + it.maxWidth = -1; + it.maxHeight = -1; }]; }