Skip to content

Commit 180363a

Browse files
author
Ignacio Romero Zurbuchen
authored
Merge pull request slackhq#547 from ClementPadovani/master
Added the placeholder’s font.
2 parents 0b20b83 + fc2bcd0 commit 180363a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Source/SLKTextView.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ UIKIT_EXTERN NSString * const SLKTextViewPastedItemData;
5050
/** The placeholder's number of lines. Default is 1. */
5151
@property (nonatomic, readwrite) NSInteger placeholderNumberOfLines;
5252

53+
/** The placeholder's font. Default is the textView's font. */
54+
@property (nonatomic, copy, null_resettable) UIFont *placeholderFont;
55+
5356
/** The maximum number of lines before enabling scrolling. Default is 0 wich means limitless.
5457
If dynamic type is enabled, the maximum number of lines will be calculated proportionally to the user preferred font size. */
5558
@property (nonatomic, readwrite) NSUInteger maxNumberOfLines;

Source/SLKTextView.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ - (UIColor *)placeholderColor
160160
return self.placeholderLabel.textColor;
161161
}
162162

163+
- (UIFont *)placeholderFont
164+
{
165+
return self.placeholderLabel.font;
166+
}
167+
163168
- (NSUInteger)numberOfLines
164169
{
165170
CGSize contentSize = self.contentSize;
@@ -408,6 +413,16 @@ - (void)setPlaceholderNumberOfLines:(NSInteger)numberOfLines
408413
[self setNeedsLayout];
409414
}
410415

416+
- (void)setPlaceholderFont:(UIFont *)placeholderFont
417+
{
418+
if (!placeholderFont) {
419+
self.placeholderLabel.font = self.font;
420+
}
421+
else {
422+
self.placeholderLabel.font = placeholderFont;
423+
}
424+
}
425+
411426
- (void)setUndoManagerEnabled:(BOOL)enabled
412427
{
413428
if (self.undoManagerEnabled == enabled) {

0 commit comments

Comments
 (0)