Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Added the placeholder’s font.
Browse files Browse the repository at this point in the history
  • Loading branch information
clementpadovani committed Nov 1, 2016
1 parent 0b20b83 commit 42959c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/SLKTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ UIKIT_EXTERN NSString * const SLKTextViewPastedItemData;
/** The placeholder's number of lines. Default is 1. */
@property (nonatomic, readwrite) NSInteger placeholderNumberOfLines;

/** The placeholder's font. Default's to our font, gets reset to our font if nil. */
@property (nonatomic, copy, null_resettable) UIFont *placeholderFont;

/** The maximum number of lines before enabling scrolling. Default is 0 wich means limitless.
If dynamic type is enabled, the maximum number of lines will be calculated proportionally to the user preferred font size. */
@property (nonatomic, readwrite) NSUInteger maxNumberOfLines;
Expand Down
13 changes: 13 additions & 0 deletions Source/SLKTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ - (UIColor *)placeholderColor
return self.placeholderLabel.textColor;
}

- (UIFont *)placeholderFont
{
return self.placeholderLabel.font;
}

- (NSUInteger)numberOfLines
{
CGSize contentSize = self.contentSize;
Expand Down Expand Up @@ -408,6 +413,14 @@ - (void)setPlaceholderNumberOfLines:(NSInteger)numberOfLines
[self setNeedsLayout];
}

- (void)setPlaceholderFont:(UIFont *)placeholderFont
{
if (!placeholderFont)
self.placeholderLabel.font = self.font;
else
self.placeholderLabel.font = placeholderFont;
}

- (void)setUndoManagerEnabled:(BOOL)enabled
{
if (self.undoManagerEnabled == enabled) {
Expand Down

0 comments on commit 42959c3

Please sign in to comment.