From 6cbee030e4d565b41052098aaf1f6864599ab67d Mon Sep 17 00:00:00 2001 From: Jari Kalinainen Date: Mon, 15 Sep 2014 14:45:54 +0300 Subject: [PATCH 1/2] Added support for keyboardAppearance (iOS7) --- class/HPGrowingTextView.h | 3 +++ class/HPGrowingTextView.m | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/class/HPGrowingTextView.h b/class/HPGrowingTextView.h index 8b343c5..34134c4 100644 --- a/class/HPGrowingTextView.h +++ b/class/HPGrowingTextView.h @@ -103,6 +103,9 @@ @property(nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0); @property (nonatomic) UIReturnKeyType returnKeyType; @property (nonatomic) UIKeyboardType keyboardType; +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 +@property (nonatomic) UIKeyboardAppearance keyboardAppearance; +#endif @property (assign) UIEdgeInsets contentInset; @property (nonatomic) BOOL isScrollable; @property(nonatomic) BOOL enablesReturnKeyAutomatically; diff --git a/class/HPGrowingTextView.m b/class/HPGrowingTextView.m index 9871c6f..31020af 100644 --- a/class/HPGrowingTextView.m +++ b/class/HPGrowingTextView.m @@ -548,6 +548,21 @@ - (UIKeyboardType)keyboardType return internalTextView.keyboardType; } +/////////////////////////////////////////////////////////////////////////////////////////////////// +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 + +- (void)setKeyboardAppearance:(UIKeyboardAppearance)keyAppearance +{ + if ([internalTextView respondsToSelector:@selector(setKeyboardAppearance:)]) { + internalTextView.keyboardAppearance = keyAppearance; + } +} + +- (UIKeyboardAppearance)keyboardAppearance +{ + return internalTextView.keyboardAppearance; +} +#endif /////////////////////////////////////////////////////////////////////////////////////////////////// - (void)setEnablesReturnKeyAutomatically:(BOOL)enablesReturnKeyAutomatically From ade3d5a20d7e3b11a97450e67c82f6c0079aa701 Mon Sep 17 00:00:00 2001 From: Jari Kalinainen Date: Mon, 15 Sep 2014 14:46:26 +0300 Subject: [PATCH 2/2] Fixed deprecated font setting (iOS7) --- class/HPTextViewInternal.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/class/HPTextViewInternal.m b/class/HPTextViewInternal.m index f3a6a1d..f8fc0ad 100644 --- a/class/HPTextViewInternal.m +++ b/class/HPTextViewInternal.m @@ -111,7 +111,11 @@ - (void)drawRect:(CGRect)rect } else { [self.placeholderColor set]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 [self.placeholder drawInRect:CGRectMake(8.0f, 8.0f, self.frame.size.width - 16.0f, self.frame.size.height - 16.0f) withFont:self.font]; +#else + [self.placeholder drawInRect:CGRectMake(8.0f, 8.0f, self.frame.size.width - 16.0f, self.frame.size.height - 16.0f) withAttributes:[[NSDictionary alloc] initWithObjectsAndKeys:self.font, NSFontAttributeName,nil]]; +#endif } } }