Skip to content

Commit

Permalink
Merge pull request #221 from nrgbodya/bugfix/flickering
Browse files Browse the repository at this point in the history
Bugfix/flickering
  • Loading branch information
jverdi committed Jul 12, 2021
2 parents 2026f5d + 04ba76d commit 69c0e80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Expand Up @@ -283,7 +283,7 @@ - (CGRect)textRectForBounds:(CGRect)bounds
if ([self.text length] || self.keepBaseline) {
rect = [self insetRectForBounds:rect];
}
return CGRectIntegral(rect);
return rect;
}

- (CGRect)editingRectForBounds:(CGRect)bounds
Expand All @@ -292,7 +292,7 @@ - (CGRect)editingRectForBounds:(CGRect)bounds
if ([self.text length] || self.keepBaseline) {
rect = [self insetRectForBounds:rect];
}
return CGRectIntegral(rect);
return rect;
}

- (CGRect)insetRectForBounds:(CGRect)rect
Expand All @@ -314,7 +314,7 @@ - (CGRect)clearButtonRectForBounds:(CGRect)bounds
rect = CGRectMake(rect.origin.x, rect.origin.y + topInset / 2.0f, rect.size.width, rect.size.height);
}
}
return CGRectIntegral(rect);
return rect;
}

- (CGRect)leftViewRectForBounds:(CGRect)bounds
Expand Down
Expand Up @@ -340,7 +340,7 @@ - (CGRect)textRect
rect.origin.y += self.textContainerInset.top;
}

return CGRectIntegral(rect);
return rect;
}

- (void)setFloatingLabelFont:(UIFont *)floatingLabelFont
Expand Down
11 changes: 11 additions & 0 deletions JVFloatLabeledTextFieldTests/JVFloatLabeledTextFieldTests.m
Expand Up @@ -89,4 +89,15 @@ - (void)testKeepBaseline
XCTAssert(CGRectEqualToRect(clearRectInitial, clearRectFinal));
}

-(void)testIntrinsicContentHeight
{
self.testField.text = @"foo";
CGFloat firstHeight = self.testField.intrinsicContentSize.height;

self.testField.text = @"bar";
CGFloat secondHeight = self.testField.intrinsicContentSize.height;

XCTAssertEqual(firstHeight, secondHeight);
}

@end

0 comments on commit 69c0e80

Please sign in to comment.