Skip to content

Commit

Permalink
Fixed placeholder label layout - it should calculate bounds consideri…
Browse files Browse the repository at this point in the history
…ng label width, not bounds width (#4)
  • Loading branch information
akievsk authored and lasha-ring committed Sep 5, 2017
1 parent e2a07f4 commit d468a39
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/SLKTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,10 @@ - (CGRect)slk_placeholderRectThatFits:(CGRect)bounds
CGFloat padding = self.textContainer.lineFragmentPadding;

CGRect rect = CGRectZero;
rect.size.height = [self.placeholderLabel sizeThatFits:bounds.size].height;
rect.size.width = self.textContainer.size.width - padding*2.0;
CGSize size = bounds.size;
size.width = self.textContainer.size.width - padding*2.0;
rect.size.height = [self.placeholderLabel sizeThatFits:size].height;
rect.size.width = size.width;
rect.origin = UIEdgeInsetsInsetRect(bounds, self.textContainerInset).origin;
rect.origin.x += padding;

Expand Down

0 comments on commit d468a39

Please sign in to comment.