diff --git a/SZTextView/Sources/SZTextView.m b/SZTextView/Sources/SZTextView.m index 5e61165..ad6b74d 100755 --- a/SZTextView/Sources/SZTextView.m +++ b/SZTextView/Sources/SZTextView.m @@ -56,6 +56,15 @@ - (id)initWithFrame:(CGRect)frame } #endif ++ (UIColor *)defaultPlaceholderColor +{ + if (@available(iOS 13.0, *)) { + return [UIColor placeholderTextColor]; + } else { + return [UIColor colorWithWhite:0.7f alpha:0.7f]; + } +} + - (void)preparePlaceholder { NSAssert(!self._placeholderTextView, @"placeholder has been prepared already: %@", self._placeholderTextView); @@ -68,7 +77,7 @@ - (void)preparePlaceholder self._placeholderTextView = [[UITextView alloc] initWithFrame:frame]; self._placeholderTextView.opaque = NO; self._placeholderTextView.backgroundColor = [UIColor clearColor]; - self._placeholderTextView.textColor = [UIColor colorWithWhite:0.7f alpha:0.7f]; + self._placeholderTextView.textColor = [self.class defaultPlaceholderColor]; self._placeholderTextView.textAlignment = self.textAlignment; self._placeholderTextView.editable = NO; self._placeholderTextView.scrollEnabled = NO; @@ -132,6 +141,13 @@ - (void)preparePlaceholder } } +- (void)tintColorDidChange +{ + [super tintColorDidChange]; + + self._placeholderTextView.textColor = [self.class defaultPlaceholderColor]; +} + - (void)setPlaceholder:(NSString *)placeholderText { _placeholder = [placeholderText copy];