From e97a4058cb84056e201c02a3626b52c390565c0a Mon Sep 17 00:00:00 2001 From: Yann Bouschet Date: Wed, 11 Feb 2015 11:14:10 -0500 Subject: [PATCH] Fixed deprecated drawInRect:withFont:lineBreakMode:alignment: --- Classes/UIImage+Dummy.m | 11 ++++++++++- .../UIImage+DummySample.xcodeproj/project.pbxproj | 6 +----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Classes/UIImage+Dummy.m b/Classes/UIImage+Dummy.m index 6c71572..414817e 100644 --- a/Classes/UIImage+Dummy.m +++ b/Classes/UIImage+Dummy.m @@ -93,7 +93,16 @@ + (UIImage *)dummyImageWithSize:(CGSize)size color:(UIColor *)color NSDictionary *attributes = @{NSParagraphStyleAttributeName : style}; [sizeString drawInRect:rect withAttributes:attributes]; } else { - [sizeString drawInRect:rect withFont:[UIFont systemFontOfSize:12] lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentCenter]; + NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail; + paragraphStyle.alignment = NSTextAlignmentCenter; + + UIFont *font = [UIFont systemFontOfSize:12]; + + NSDictionary *attributes = @{NSFontAttributeName: font, + NSParagraphStyleAttributeName: paragraphStyle}; + + [sizeString drawInRect:rect withAttributes:attributes]; } UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); diff --git a/UIImage+DummySample/UIImage+DummySample.xcodeproj/project.pbxproj b/UIImage+DummySample/UIImage+DummySample.xcodeproj/project.pbxproj index f6622bf..d1ea128 100644 --- a/UIImage+DummySample/UIImage+DummySample.xcodeproj/project.pbxproj +++ b/UIImage+DummySample/UIImage+DummySample.xcodeproj/project.pbxproj @@ -222,7 +222,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = ID; - LastUpgradeCheck = 0500; + LastUpgradeCheck = 0610; ORGANIZATIONNAME = CAPH; TargetAttributes = { 6AE42011188F3AD100A6E038 = { @@ -337,7 +337,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -376,7 +375,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -436,7 +434,6 @@ 6AE42027188F3AD100A6E038 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UIImage+DummySample.app/UIImage+DummySample"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -459,7 +456,6 @@ 6AE42028188F3AD100A6E038 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UIImage+DummySample.app/UIImage+DummySample"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks",