From 6a34940c318145456d827b9568ea2668413db698 Mon Sep 17 00:00:00 2001 From: Alexander Kievsky Date: Sun, 3 Sep 2017 17:44:15 +0300 Subject: [PATCH] Fixed placeholder label layout - it should calculate bounds considering label width, not bounds width --- Source/SLKTextView.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/SLKTextView.m b/Source/SLKTextView.m index 08a43081..94d3d02d 100644 --- a/Source/SLKTextView.m +++ b/Source/SLKTextView.m @@ -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;