diff --git a/class/HPTextViewInternal.m b/class/HPTextViewInternal.m index f3a6a1d..5ecaf03 100644 --- a/class/HPTextViewInternal.m +++ b/class/HPTextViewInternal.m @@ -103,16 +103,15 @@ - (void)drawRect:(CGRect)rect [super drawRect:rect]; if (self.displayPlaceHolder && self.placeholder && self.placeholderColor) { - if ([self respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)]) - { - NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; - paragraphStyle.alignment = self.textAlignment; - [self.placeholder drawInRect:CGRectMake(5, 8 + self.contentInset.top, self.frame.size.width-self.contentInset.left, self.frame.size.height- self.contentInset.top) withAttributes:@{NSFontAttributeName:self.font, NSForegroundColorAttributeName:self.placeholderColor, NSParagraphStyleAttributeName:paragraphStyle}]; - } - else { - [self.placeholderColor set]; - [self.placeholder drawInRect:CGRectMake(8.0f, 8.0f, self.frame.size.width - 16.0f, self.frame.size.height - 16.0f) withFont:self.font]; - } + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.alignment = self.textAlignment; + + [self.placeholder drawInRect:CGRectMake(5, 8 + self.contentInset.top, self.frame.size.width-self.contentInset.left, self.frame.size.height- self.contentInset.top) + withAttributes:@{NSFontAttributeName:self.font, + NSForegroundColorAttributeName:self.placeholderColor, + NSParagraphStyleAttributeName:paragraphStyle} + ]; } } diff --git a/example/Classes/GrowingTextViewExampleAppDelegate.m b/example/Classes/GrowingTextViewExampleAppDelegate.m index 9cf8920..1a9c85b 100644 --- a/example/Classes/GrowingTextViewExampleAppDelegate.m +++ b/example/Classes/GrowingTextViewExampleAppDelegate.m @@ -44,7 +44,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( viewController = [[GrowingTextViewExampleViewController alloc] init]; // Add the view controller's view to the window and display. - [window addSubview:viewController.view]; + window.rootViewController = viewController; [window makeKeyAndVisible]; return YES; diff --git a/example/GrowingTextViewExample-Info.plist b/example/GrowingTextViewExample-Info.plist index 3289444..276e6f6 100644 --- a/example/GrowingTextViewExample-Info.plist +++ b/example/GrowingTextViewExample-Info.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/example/GrowingTextViewExample.xcodeproj/project.pbxproj b/example/GrowingTextViewExample.xcodeproj/project.pbxproj index 53f47ed..3c85247 100755 --- a/example/GrowingTextViewExample.xcodeproj/project.pbxproj +++ b/example/GrowingTextViewExample.xcodeproj/project.pbxproj @@ -176,7 +176,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0910; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GrowingTextViewExample" */; compatibilityVersion = "Xcode 3.2"; @@ -245,9 +245,11 @@ GCC_PREFIX_HEADER = GrowingTextViewExample_Prefix.pch; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "GrowingTextViewExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = GrowingTextViewExample; SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; @@ -261,9 +263,11 @@ GCC_PREFIX_HEADER = GrowingTextViewExample_Prefix.pch; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "GrowingTextViewExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = GrowingTextViewExample; SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = 1; VALIDATE_PRODUCT = YES; }; name = Release; @@ -271,11 +275,35 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; @@ -283,11 +311,33 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; };