iOS:Text's max width and max height can only be affected while >0
This commit is contained in:
parent
139a8775d4
commit
d088e30f38
@ -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;
|
||||
}];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user