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; }]; }