├── .gitignore ├── DDCornerRadius.podspec ├── DDCornerRadius ├── DDCornerRadius.h ├── UIImage+DDCornerRadius.h ├── UIImage+DDCornerRadius.m ├── UIView+DDCornerRadius.h └── UIView+DDCornerRadius.m ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Example │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── demo1.imageset │ │ │ ├── Contents.json │ │ │ └── demo1.jpg │ │ ├── demo2.imageset │ │ │ ├── Contents.json │ │ │ └── demo2.jpg │ │ └── demo3.imageset │ │ │ ├── Contents.json │ │ │ └── demo3.jpg │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── ExampleTableViewCell.h │ ├── ExampleTableViewCell.m │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── ExampleTests │ ├── ExampleTests.m │ └── Info.plist └── ExampleUITests │ ├── ExampleUITests.m │ └── Info.plist ├── LICENSE ├── README.md └── Screenshot.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | .DS_Store 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | *.dSYM.zip 30 | *.dSYM 31 | 32 | # CocoaPods 33 | # 34 | # We recommend against adding the Pods directory to your .gitignore. However 35 | # you should judge for yourself, the pros and cons are mentioned at: 36 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 37 | # 38 | # Pods/ 39 | 40 | # Carthage 41 | # 42 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 43 | # Carthage/Checkouts 44 | 45 | Carthage/Build 46 | 47 | # fastlane 48 | # 49 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 50 | # screenshots whenever they are needed. 51 | # For more information about the recommended setup visit: 52 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 53 | 54 | fastlane/report.xml 55 | fastlane/Preview.html 56 | fastlane/screenshots 57 | fastlane/test_output 58 | 59 | # Code Injection 60 | # 61 | # After new code Injection tools there's a generated folder /iOSInjectionProject 62 | # https://github.com/johnno1962/injectionforxcode 63 | 64 | iOSInjectionProject/ 65 | -------------------------------------------------------------------------------- /DDCornerRadius.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint DDCornerRadius.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "DDCornerRadius" 19 | s.version = "1.0" 20 | s.summary = "A Picture Rounded Carton Optimization Processing Framework." 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | s.description = <<-DESC 28 | Optimize image fillet processing to avoid performance loss caused by off-screen rendering and optimize the stuck phenomenon. 29 | DESC 30 | 31 | s.homepage = "https://github.com/charsdavy/DDCornerRadius" 32 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 33 | 34 | 35 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 36 | # 37 | # Licensing your code is important. See http://choosealicense.com for more info. 38 | # CocoaPods will detect a license file if there is a named LICENSE* 39 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 40 | # 41 | 42 | s.license = { :type => "MIT", :file => "LICENSE" } 43 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 44 | 45 | 46 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 47 | # 48 | # Specify the authors of the library, with email addresses. Email addresses 49 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 50 | # accepts just a name if you'd rather not provide an email address. 51 | # 52 | # Specify a social_media_url where others can refer to, for example a twitter 53 | # profile URL. 54 | # 55 | 56 | s.author = { "charsdavy" => "chars.davy@gmail.com" } 57 | s.social_media_url = "https://twitter.com/charsdavy" 58 | 59 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 60 | # 61 | # If this Pod runs only on iOS or OS X, then specify the platform and 62 | # the deployment target. You can optionally include the target after the platform. 63 | # 64 | 65 | s.platform = :ios 66 | s.platform = :ios, "8.0" 67 | 68 | # When using multiple platforms 69 | s.ios.deployment_target = "8.0" 70 | # s.osx.deployment_target = "10.7" 71 | # s.watchos.deployment_target = "2.0" 72 | # s.tvos.deployment_target = "9.0" 73 | 74 | 75 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 76 | # 77 | # Specify the location from where the source should be retrieved. 78 | # Supports git, hg, bzr, svn and HTTP. 79 | # 80 | 81 | s.source = { :git => "https://github.com/charsdavy/DDCornerRadius.git", :tag => "#{s.version}" } 82 | 83 | 84 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 85 | # 86 | # CocoaPods is smart about how it includes source code. For source files 87 | # giving a folder will include any swift, h, m, mm, c & cpp files. 88 | # For header files it will include any header in the folder. 89 | # Not including the public_header_files will make all headers public. 90 | # 91 | 92 | s.source_files = "DDCornerRadius/*.{h,m}" 93 | # s.exclude_files = "Classes/Exclude" 94 | 95 | # s.public_header_files = "Classes/**/*.h" 96 | 97 | 98 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 99 | # 100 | # A list of resources included with the Pod. These are copied into the 101 | # target bundle with a build phase script. Anything else will be cleaned. 102 | # You can preserve files from being cleaned, please don't preserve 103 | # non-essential files like tests, examples and documentation. 104 | # 105 | 106 | # s.resource = "icon.png" 107 | # s.resources = "Resources/*.png" 108 | 109 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 110 | 111 | 112 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 113 | # 114 | # Link your library with frameworks, or libraries. Libraries do not include 115 | # the lib prefix of their name. 116 | # 117 | 118 | # s.framework = "SomeFramework" 119 | # s.frameworks = "SomeFramework", "AnotherFramework" 120 | 121 | # s.library = "iconv" 122 | # s.libraries = "iconv", "xml2" 123 | 124 | 125 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 126 | # 127 | # If your library depends on compiler flags you can set them in the xcconfig hash 128 | # where they will only apply to your library. If you depend on other Podspecs 129 | # you can include multiple dependencies to ensure it works. 130 | 131 | # s.requires_arc = true 132 | 133 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 134 | # s.dependency "JSONKit", "~> 1.4" 135 | 136 | end 137 | -------------------------------------------------------------------------------- /DDCornerRadius/DDCornerRadius.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDCornerRadius.h 3 | // DDCornerRadius 4 | // 5 | // Created by dengw on 2017/7/4. 6 | // Copyright © 2017年 Chars. All rights reserved. 7 | // 8 | 9 | #ifndef DDCornerRadius_h 10 | #define DDCornerRadius_h 11 | 12 | #import "UIImage+DDCornerRadius.h" 13 | #import "UIView+DDCornerRadius.h" 14 | 15 | #endif /* DDCornerRadius_h */ 16 | -------------------------------------------------------------------------------- /DDCornerRadius/UIImage+DDCornerRadius.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DDCornerRadius.h 3 | // DDCornerRadius 4 | // 5 | // Created by dengw on 2017/6/27. 6 | // Copyright © 2017年 Chars. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (DDCornerRadius) 12 | 13 | /** 14 | 将图片进行圆形切割处理,默认无边框(PS:此操作是线程安全的)。 15 | @param scaleSize 图片将会缩放成的目标大小 16 | @return 返回处理之后的图片 17 | */ 18 | - (nullable UIImage *)dd_imageByRoundScaleSize:(CGSize)scaleSize; 19 | 20 | /** 21 | 将图片进行圆角处理,并加上边框(PS:此操作是线程安全的)。 22 | @param radius 圆角大小 23 | @param scaleSize 图片将会缩放成的目标大小 24 | @param borderWidth 边框宽度 25 | @param borderColor 边框颜色 26 | @param corners 图片圆角样式(UIRectCorner) 27 | @return 返回处理之后的图片 28 | */ 29 | - (nullable UIImage *)dd_imageByCornerRadius:(CGFloat)radius 30 | scaleSize:(CGSize)scaleSize 31 | borderWidth:(CGFloat)borderWidth 32 | borderColor:(nullable UIColor *)borderColor 33 | corners:(UIRectCorner)corners; 34 | 35 | /** 36 | 图片加上圆形边框,图片必须得是正方形的,否则直接返回未加边框的原图片(PS:此操作是线程安全的) 37 | @param color 边框颜色 38 | @param width 边框宽度 39 | @return 返回处理之后的图片 40 | */ 41 | - (nullable UIImage *)dd_imageByRoundBorderedColor:(nullable UIColor *)color 42 | borderWidth:(CGFloat)width; 43 | 44 | /** 45 | 创建一张纯色的圆形图片 46 | @param color 图片填充的颜色 47 | @param size 图片的大小 48 | @return 返回纯色的圆形图片 49 | */ 50 | + (nullable UIImage *)dd_roundImageWithColor:(nullable UIColor *)color 51 | size:(CGSize)size; 52 | 53 | /** 54 | 图片加上边框 (PS:此操作是线程安全的) 55 | @param radius 圆角大小 56 | @param borderColor 边框颜色 57 | @param borderWidth 边框宽度 58 | @param corners 图片圆角样式(UIRectCorner) 59 | @return 返回处理之后的图片 60 | */ 61 | - (nullable UIImage *)dd_imageByCornerRadius:(CGFloat)radius 62 | borderedColor:(nullable UIColor *)borderColor 63 | borderWidth:(CGFloat)borderWidth 64 | corners:(UIRectCorner)corners; 65 | 66 | /** 67 | 将图片指定圆角样式处理,并加上边框(PS:此操作是线程安全的)。 68 | @param radius 圆角大小 69 | @param corners 图片圆角样式(UIRectCorner) 70 | @param borderWidth 边框宽度 71 | @param borderColor 边框颜色 72 | @return 返回处理之后的图片 73 | */ 74 | - (nullable UIImage *)dd_imageByCornerRadius:(CGFloat)radius 75 | corners:(UIRectCorner)corners 76 | borderWidth:(CGFloat)borderWidth 77 | borderColor:(nullable UIColor *)borderColor; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /DDCornerRadius/UIImage+DDCornerRadius.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DDCornerRadius.m 3 | // DDCornerRadius 4 | // 5 | // Created by dengw on 2017/6/27. 6 | // Copyright © 2017年 Chars. All rights reserved. 7 | // 8 | 9 | #import "UIImage+DDCornerRadius.h" 10 | 11 | @implementation UIImage (DDCornerRadius) 12 | 13 | - (UIImage *)dd_imageByRoundScaleSize:(CGSize)scaleSize 14 | { 15 | if (scaleSize.width > 0 && scaleSize.height > 0) { 16 | CGFloat minSize = MIN(scaleSize.width, scaleSize.height); 17 | CGFloat radius = minSize / 2.0; 18 | return [self dd_imageByCornerRadius:radius scaleSize:scaleSize borderWidth:0 borderColor:nil corners:UIRectCornerAllCorners]; 19 | } 20 | return self; 21 | } 22 | 23 | - (UIImage *)dd_imageByCornerRadius:(CGFloat)radius 24 | scaleSize:(CGSize)scaleSize 25 | borderWidth:(CGFloat)borderWidth 26 | borderColor:(UIColor *)borderColor 27 | corners:(UIRectCorner)corners 28 | { 29 | if (radius > 0 && scaleSize.width > 0 && scaleSize.height > 0) { 30 | UIImage *scaledImage = [self dd_imageByScalingAndCroppingToSize:scaleSize]; 31 | if (scaledImage) { 32 | return [scaledImage dd_imageByCornerRadius:radius 33 | corners:corners 34 | borderWidth:borderWidth 35 | borderColor:borderColor]; 36 | } 37 | } 38 | return self; 39 | } 40 | 41 | - (UIImage *)dd_imageByCornerRadius:(CGFloat)radius 42 | corners:(UIRectCorner)corners 43 | borderWidth:(CGFloat)borderWidth 44 | borderColor:(UIColor *)borderColor 45 | { 46 | if (corners != UIRectCornerAllCorners) { 47 | UIRectCorner tmp = 0; 48 | if (corners & UIRectCornerTopLeft) tmp |= UIRectCornerBottomLeft; 49 | if (corners & UIRectCornerTopRight) tmp |= UIRectCornerBottomRight; 50 | if (corners & UIRectCornerBottomLeft) tmp |= UIRectCornerTopLeft; 51 | if (corners & UIRectCornerBottomRight) tmp |= UIRectCornerTopRight; 52 | corners = tmp; 53 | } 54 | 55 | UIGraphicsBeginImageContextWithOptions(self.size, NO, 0); 56 | CGContextRef context = UIGraphicsGetCurrentContext(); 57 | CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height); 58 | CGContextScaleCTM(context, 1, -1); 59 | CGContextTranslateCTM(context, 0, -rect.size.height); 60 | 61 | CGFloat minSize = MIN(self.size.width, self.size.height); 62 | if (borderWidth < minSize / 2.0) { 63 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadii:CGSizeMake(radius, borderWidth)]; 64 | CGContextSaveGState(context); 65 | [path addClip]; 66 | CGContextDrawImage(context, rect, self.CGImage); 67 | CGContextRestoreGState(context); 68 | } 69 | 70 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 71 | image = [image dd_imageByCornerRadius:radius borderedColor:borderColor borderWidth:borderWidth corners:corners]; 72 | UIGraphicsEndImageContext(); 73 | return image; 74 | } 75 | 76 | - (UIImage *)dd_imageByRoundBorderedColor:(UIColor *)borderColor 77 | borderWidth:(CGFloat)borderWidth 78 | { 79 | if (self.size.height != self.size.width) { 80 | return self; 81 | } 82 | 83 | return [self dd_imageByCornerRadius:self.size.width / 2.0 borderedColor:borderColor borderWidth:borderWidth corners:UIRectCornerAllCorners]; 84 | } 85 | 86 | - (UIImage *)dd_imageByCornerRadius:(CGFloat)radius 87 | borderedColor:(UIColor *)borderColor 88 | borderWidth:(CGFloat)borderWidth 89 | corners:(UIRectCorner)corners 90 | { 91 | if (!borderColor || borderWidth > MIN(self.size.width, self.size.height) / 2.0 || borderWidth < 0) { 92 | return self; 93 | } 94 | 95 | if (corners != UIRectCornerAllCorners) { 96 | UIRectCorner tmp = 0; 97 | if (corners & UIRectCornerTopLeft) tmp |= UIRectCornerBottomLeft; 98 | if (corners & UIRectCornerTopRight) tmp |= UIRectCornerBottomRight; 99 | if (corners & UIRectCornerBottomLeft) tmp |= UIRectCornerTopLeft; 100 | if (corners & UIRectCornerBottomRight) tmp |= UIRectCornerTopRight; 101 | corners = tmp; 102 | } 103 | 104 | UIGraphicsBeginImageContextWithOptions(self.size, NO, 0); 105 | [self drawAtPoint:CGPointZero]; 106 | CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height); 107 | CGFloat strokeInset = borderWidth / 2.0; 108 | CGRect strokeRect = CGRectInset(rect, strokeInset, strokeInset); 109 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:strokeRect byRoundingCorners:corners cornerRadii:CGSizeMake(radius, borderWidth)]; 110 | path.lineWidth = borderWidth; 111 | [borderColor setStroke]; 112 | [path stroke]; 113 | UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); 114 | UIGraphicsEndImageContext(); 115 | return result; 116 | } 117 | 118 | + (UIImage *)dd_roundImageWithColor:(UIColor *)color 119 | size:(CGSize)size 120 | { 121 | CGRect rect = CGRectMake(0, 0, 1, 1); 122 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0); 123 | CGContextRef context = UIGraphicsGetCurrentContext(); 124 | CGContextSetFillColorWithColor(context, color.CGColor); 125 | CGContextFillRect(context, rect); 126 | UIImage *colorImage = UIGraphicsGetImageFromCurrentImageContext(); 127 | UIGraphicsEndImageContext(); 128 | UIImage *roundedColorImage = [colorImage dd_imageByRoundScaleSize:size]; 129 | return roundedColorImage; 130 | } 131 | 132 | /** 133 | 先找出image宽和高中缩放程度较小者,作为整个图片的缩放比例。 134 | 再将图片放入drawInRect函数的rect的中央。 135 | 最后将超过的宽或高裁剪,得到缩放后的图片。 136 | 137 | 在使用时应该检查返回值是否为nil 138 | */ 139 | - (UIImage *)dd_imageByScalingAndCroppingToSize:(CGSize)targetSize 140 | { 141 | UIImage *sourceImage = self; 142 | UIImage *newImage = nil; 143 | CGSize imageSize = sourceImage.size; 144 | CGFloat width = imageSize.width; 145 | CGFloat height = imageSize.height; 146 | 147 | CGFloat targetWidth = targetSize.width; 148 | CGFloat targetHeight = targetSize.height; 149 | 150 | CGFloat scaleFactor = 0.0; 151 | CGFloat scaledWidth = targetWidth; 152 | CGFloat scaledHeight = targetHeight; 153 | CGPoint thumbnailPoint = CGPointMake(0.0, 0.0); 154 | 155 | if (CGSizeEqualToSize(imageSize, targetSize) == NO) { 156 | CGFloat widthFactor = targetWidth / width; 157 | CGFloat heightFactor = targetHeight / height; 158 | 159 | if (widthFactor > heightFactor) scaleFactor = widthFactor; // scale to fit height 160 | else scaleFactor = heightFactor; // scale to fit width 161 | 162 | scaledWidth = width * scaleFactor; 163 | scaledHeight = height * scaleFactor; 164 | 165 | // center the image 166 | if (widthFactor > heightFactor) { 167 | thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5; 168 | } else if (widthFactor < heightFactor) { 169 | thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5; 170 | } 171 | } 172 | 173 | UIGraphicsBeginImageContextWithOptions(targetSize, NO, 0); // this will crop 174 | CGRect thumbnailRect = CGRectZero; 175 | 176 | thumbnailRect.origin = thumbnailPoint; 177 | thumbnailRect.size.width = scaledWidth; 178 | thumbnailRect.size.height = scaledHeight; 179 | 180 | [sourceImage drawInRect:thumbnailRect]; 181 | 182 | newImage = UIGraphicsGetImageFromCurrentImageContext(); 183 | 184 | UIGraphicsEndImageContext(); 185 | 186 | return newImage; 187 | } 188 | 189 | @end 190 | -------------------------------------------------------------------------------- /DDCornerRadius/UIView+DDCornerRadius.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DDCornerRadius.h 3 | // DDCornerRadius 4 | // 5 | // Created by dengw on 2017/6/27. 6 | // Copyright © 2017年 Chars. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (DDCornerRadius) 12 | 13 | /** 14 | 设置一个四角圆角 15 | 16 | @param radius 圆角半径 17 | @param color 圆角背景色 18 | */ 19 | - (void)dd_quadrateCornerWithRadius:(CGFloat)radius 20 | cornerColor:(UIColor *)color; 21 | 22 | /** 23 | 设置一个普通圆角 24 | 25 | @param radius 圆角半径 26 | @param color 圆角背景色 27 | @param corners 圆角位置 28 | */ 29 | - (void)dd_cornerWithRadius:(CGFloat)radius 30 | cornerColor:(UIColor *)color 31 | corners:(UIRectCorner)corners; 32 | 33 | /** 34 | 设置一个带边框的圆角 35 | 36 | @param radius 圆角半径 37 | @param color 圆角背景色. 如果为nil,优先选取view,沿superview上的父类容器的背景色 38 | @param corners 圆角位置 39 | @param borderColor 边框颜色 40 | @param borderWidth 边框线宽 41 | */ 42 | - (void)dd_cornerWithRadius:(CGFloat)radius 43 | cornerColor:(UIColor *)color 44 | corners:(UIRectCorner)corners 45 | borderColor:(UIColor *)borderColor 46 | borderWidth:(CGFloat)borderWidth; 47 | 48 | /** 49 | 设置一个带边框的四方圆角 50 | 51 | @param radius 圆角半径 52 | @param color 圆角背景色. 如果为nil,优先选取view,沿superview上的父类容器的背景色 53 | @param borderColor 边框颜色 54 | @param borderWidth 边框线宽 55 | */ 56 | - (void)dd_quadrateCornerWithRadius:(CGFloat)radius 57 | cornerColor:(UIColor *)color 58 | borderColor:(UIColor *)borderColor 59 | borderWidth:(CGFloat)borderWidth; 60 | 61 | @end 62 | 63 | @interface CALayer (ZKRCornerRadius) 64 | 65 | - (void)dd_cornerWithRadius:(CGFloat)radius 66 | cornerColor:(UIColor *)color; 67 | 68 | - (void)dd_cornerWithRadius:(CGFloat)radius 69 | cornerColor:(UIColor *)color 70 | corners:(UIRectCorner)corners; 71 | 72 | - (void)dd_cornerWithRadius:(CGFloat)radius 73 | cornerColor:(UIColor *)color 74 | corners:(UIRectCorner)corners 75 | borderColor:(UIColor *)borderColor 76 | borderWidth:(CGFloat)borderWidth; 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /DDCornerRadius/UIView+DDCornerRadius.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DDCornerRadius.m 3 | // DDCornerRadius 4 | // 5 | // Created by dengw on 2017/6/27. 6 | // Copyright © 2017年 Chars. All rights reserved. 7 | // 8 | 9 | #import "UIView+DDCornerRadius.h" 10 | #import 11 | 12 | @implementation UIView (DDCornerRadius) 13 | 14 | - (void)dd_quadrateCornerWithRadius:(CGFloat)radius 15 | cornerColor:(UIColor *)color 16 | { 17 | if (!color) { 18 | color = [self cornerColor]; 19 | } 20 | 21 | [self.layer dd_cornerWithRadius:radius cornerColor:color]; 22 | } 23 | 24 | - (void)dd_cornerWithRadius:(CGFloat)radius 25 | cornerColor:(UIColor *)color 26 | corners:(UIRectCorner)corners 27 | { 28 | if (!color) { 29 | color = [self cornerColor]; 30 | } 31 | 32 | [self.layer dd_cornerWithRadius:radius cornerColor:color corners:corners]; 33 | } 34 | 35 | - (void)dd_cornerWithRadius:(CGFloat)radius 36 | cornerColor:(UIColor *)color 37 | corners:(UIRectCorner)corners 38 | borderColor:(UIColor *)borderColor 39 | borderWidth:(CGFloat)borderWidth 40 | { 41 | if (!color) { 42 | color = [self cornerColor]; 43 | } 44 | 45 | [self.layer dd_cornerWithRadius:radius cornerColor:color corners:corners borderColor:borderColor borderWidth:borderWidth]; 46 | } 47 | 48 | - (void)dd_quadrateCornerWithRadius:(CGFloat)radius 49 | cornerColor:(UIColor *)color 50 | borderColor:(UIColor *)borderColor 51 | borderWidth:(CGFloat)borderWidth 52 | { 53 | [self dd_cornerWithRadius:radius cornerColor:color corners:UIRectCornerAllCorners borderColor:borderColor borderWidth:borderWidth]; 54 | } 55 | 56 | - (UIColor *)cornerColor 57 | { 58 | UIView *superview = self.superview; 59 | while (superview.backgroundColor == nil || CGColorGetAlpha(superview.backgroundColor.CGColor) == 0 || superview.alpha == 0 || superview.opaque == 0) { 60 | if (!superview) { 61 | break; 62 | } 63 | superview = [superview superview]; 64 | } 65 | 66 | return superview.backgroundColor; 67 | } 68 | 69 | @end 70 | 71 | static void *const _DDMaskCornerRadiusLayerKey = "_DDMaskCornerRadiusLayerKey"; 72 | static NSMutableSet *maskCornerRaidusImageSet; 73 | 74 | @implementation NSObject (DDCornerRadius) 75 | 76 | - (void)dd_setCornerRadiusAttribute:(id)value 77 | withKey:(void *)key 78 | { 79 | objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 80 | } 81 | 82 | - (id)dd_getCornerRadiusAttributeForKey:(void *)key 83 | { 84 | return objc_getAssociatedObject(self, key); 85 | } 86 | 87 | - (void)dd_removeCornerRadiusAttributeWithKey:(void *)key 88 | { 89 | objc_setAssociatedObject(self, key, nil, OBJC_ASSOCIATION_ASSIGN); 90 | } 91 | 92 | @end 93 | 94 | @implementation UIImage (DDCornerRadius) 95 | 96 | + (UIImage *)dd_maskRoundCornerRadiusImageWithColor:(UIColor *)color 97 | cornerRadii:(CGSize)cornerRadii 98 | size:(CGSize)size 99 | corners:(UIRectCorner)corners 100 | borderColor:(UIColor *)borderColor 101 | borderWidth:(CGFloat)borderWidth 102 | { 103 | UIGraphicsBeginImageContextWithOptions(size, NO, 0); 104 | CGContextRef context = UIGraphicsGetCurrentContext(); 105 | 106 | CGContextSetLineWidth(context, 0); 107 | [color set]; 108 | CGRect rect = CGRectMake(0, 0, size.width, size.height); 109 | UIBezierPath *rectPath = [UIBezierPath bezierPathWithRect:rect]; 110 | UIBezierPath *roundPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:cornerRadii]; 111 | [rectPath appendPath:roundPath]; 112 | CGContextAddPath(context, rectPath.CGPath); 113 | CGContextEOFillPath(context); 114 | if (borderColor && borderWidth) { 115 | [borderColor set]; 116 | UIBezierPath *borderOutterPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:cornerRadii]; 117 | UIBezierPath *borderInnerPath = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadii:cornerRadii]; 118 | [borderOutterPath appendPath:borderInnerPath]; 119 | CGContextAddPath(context, borderOutterPath.CGPath); 120 | } 121 | CGContextEOFillPath(context); 122 | 123 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 124 | UIGraphicsEndImageContext(); 125 | return image; 126 | } 127 | 128 | @end 129 | 130 | @implementation CALayer (DDCornerRadius) 131 | 132 | + (void)load 133 | { 134 | Method originalMethod = class_getInstanceMethod(self, @selector(layoutSublayers)); 135 | Method newMethod = class_getInstanceMethod(self, @selector(_dd_layoutSublayers)); 136 | if (!originalMethod || !newMethod) return; 137 | method_exchangeImplementations(originalMethod, newMethod); 138 | } 139 | 140 | - (UIImage *)contentImage 141 | { 142 | return [UIImage imageWithCGImage:(__bridge CGImageRef)self.contents]; 143 | } 144 | 145 | - (void)setContentImage:(UIImage *)contentImage 146 | { 147 | self.contents = (__bridge id)contentImage.CGImage; 148 | } 149 | 150 | - (void)dd_cornerWithRadius:(CGFloat)radius 151 | cornerColor:(UIColor *)color 152 | { 153 | [self dd_cornerWithRadius:radius cornerColor:color corners:UIRectCornerAllCorners]; 154 | } 155 | 156 | - (void)dd_cornerWithRadius:(CGFloat)radius 157 | cornerColor:(UIColor *)color 158 | corners:(UIRectCorner)corners 159 | { 160 | [self dd_cornerWithRadius:radius cornerColor:color corners:corners borderColor:nil borderWidth:0]; 161 | } 162 | 163 | - (void)dd_cornerWithRadius:(CGFloat)radius 164 | cornerColor:(UIColor *)color 165 | corners:(UIRectCorner)corners 166 | borderColor:(UIColor *)borderColor 167 | borderWidth:(CGFloat)borderWidth 168 | { 169 | if (!color) return; 170 | CALayer *cornerRadiusLayer = [self dd_getCornerRadiusAttributeForKey:_DDMaskCornerRadiusLayerKey]; 171 | if (!cornerRadiusLayer) { 172 | cornerRadiusLayer = [CALayer new]; 173 | cornerRadiusLayer.opaque = YES; 174 | [self dd_setCornerRadiusAttribute:cornerRadiusLayer withKey:_DDMaskCornerRadiusLayerKey]; 175 | } 176 | if (color) { 177 | [cornerRadiusLayer dd_setCornerRadiusAttribute:color withKey:"_dd_cornerRadiusImageColor"]; 178 | } else { 179 | [cornerRadiusLayer dd_removeCornerRadiusAttributeWithKey:"_dd_cornerRadiusImageColor"]; 180 | } 181 | [cornerRadiusLayer dd_setCornerRadiusAttribute:[NSValue valueWithCGSize:CGSizeMake(radius, radius)] withKey:"_dd_cornerRadiusImageRadius"]; 182 | [cornerRadiusLayer dd_setCornerRadiusAttribute:@(corners) withKey:"_dd_cornerRadiusImageCorners"]; 183 | if (borderColor) { 184 | [cornerRadiusLayer dd_setCornerRadiusAttribute:borderColor withKey:"_dd_cornerRadiusImageBorderColor"]; 185 | } else { 186 | [cornerRadiusLayer dd_removeCornerRadiusAttributeWithKey:"_dd_cornerRadiusImageBorderColor"]; 187 | } 188 | [cornerRadiusLayer dd_setCornerRadiusAttribute:@(borderWidth) withKey:"_dd_cornerRadiusImageBorderWidth"]; 189 | UIImage *image = [self _dd_getCornerRadiusImageFromSet]; 190 | if (image) { 191 | [CATransaction begin]; 192 | [CATransaction setDisableActions:YES]; 193 | cornerRadiusLayer.contentImage = image; 194 | [CATransaction commit]; 195 | } 196 | } 197 | 198 | - (UIImage *)_dd_getCornerRadiusImageFromSet 199 | { 200 | if (!self.bounds.size.width || !self.bounds.size.height) return nil; 201 | CALayer *cornerRadiusLayer = [self dd_getCornerRadiusAttributeForKey:_DDMaskCornerRadiusLayerKey]; 202 | UIColor *color = [cornerRadiusLayer dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageColor"]; 203 | if (!color) return nil; 204 | CGSize radius = [[cornerRadiusLayer dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageRadius"] CGSizeValue]; 205 | NSUInteger corners = [[cornerRadiusLayer dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageCorners"] unsignedIntegerValue]; 206 | CGFloat borderWidth = [[cornerRadiusLayer dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageBorderWidth"] floatValue]; 207 | UIColor *borderColor = [cornerRadiusLayer dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageBorderColor"]; 208 | if (!maskCornerRaidusImageSet) { 209 | maskCornerRaidusImageSet = [NSMutableSet new]; 210 | } 211 | __block UIImage *image = nil; 212 | [maskCornerRaidusImageSet enumerateObjectsUsingBlock:^(UIImage *_Nonnull obj, BOOL *_Nonnull stop) { 213 | CGSize imageSize = [[obj dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageSize"] CGSizeValue]; 214 | UIColor *imageColor = [obj dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageColor"]; 215 | CGSize imageRadius = [[obj dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageRadius"] CGSizeValue]; 216 | NSUInteger imageCorners = [[obj dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageCorners"] unsignedIntegerValue]; 217 | CGFloat imageBorderWidth = [[obj dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageBorderWidth"] floatValue]; 218 | UIColor *imageBorderColor = [obj dd_getCornerRadiusAttributeForKey:"_dd_cornerRadiusImageBorderColor"]; 219 | BOOL isBorderSame = (CGColorEqualToColor(borderColor.CGColor, imageBorderColor.CGColor) && borderWidth == imageBorderWidth) || (!borderColor && !imageBorderColor) || (!borderWidth && !imageBorderWidth); 220 | BOOL canReuse = CGSizeEqualToSize(self.bounds.size, imageSize) && CGColorEqualToColor(imageColor.CGColor, color.CGColor) && imageCorners == corners && CGSizeEqualToSize(radius, imageRadius) && isBorderSame; 221 | if (canReuse) { 222 | image = obj; 223 | *stop = YES; 224 | } 225 | }]; 226 | if (!image) { 227 | image = [UIImage dd_maskRoundCornerRadiusImageWithColor:color cornerRadii:radius size:self.bounds.size corners:corners borderColor:borderColor borderWidth:borderWidth]; 228 | [image dd_setCornerRadiusAttribute:[NSValue valueWithCGSize:self.bounds.size] withKey:"_dd_cornerRadiusImageSize"]; 229 | [image dd_setCornerRadiusAttribute:color withKey:"_dd_cornerRadiusImageColor"]; 230 | [image dd_setCornerRadiusAttribute:[NSValue valueWithCGSize:radius] withKey:"_dd_cornerRadiusImageRadius"]; 231 | [image dd_setCornerRadiusAttribute:@(corners) withKey:"_dd_cornerRadiusImageCorners"]; 232 | if (borderColor) { 233 | [image dd_setCornerRadiusAttribute:color withKey:"_dd_cornerRadiusImageBorderColor"]; 234 | } 235 | [image dd_setCornerRadiusAttribute:@(borderWidth) withKey:"_dd_cornerRadiusImageBorderWidth"]; 236 | [maskCornerRaidusImageSet addObject:image]; 237 | } 238 | return image; 239 | } 240 | 241 | #pragma mark - exchage Methods 242 | 243 | - (void)_dd_layoutSublayers 244 | { 245 | [self _dd_layoutSublayers]; 246 | 247 | CALayer *cornerRadiusLayer = [self dd_getCornerRadiusAttributeForKey:_DDMaskCornerRadiusLayerKey]; 248 | if (cornerRadiusLayer) { 249 | UIImage *aImage = [self _dd_getCornerRadiusImageFromSet]; 250 | [CATransaction begin]; 251 | [CATransaction setDisableActions:YES]; 252 | cornerRadiusLayer.contentImage = aImage; 253 | cornerRadiusLayer.frame = self.bounds; 254 | [CATransaction commit]; 255 | [self addSublayer:cornerRadiusLayer]; 256 | } 257 | } 258 | 259 | @end 260 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B97AB3120FC9ABF00155A53 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB3020FC9ABF00155A53 /* AppDelegate.m */; }; 11 | 4B97AB3420FC9ABF00155A53 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB3320FC9ABF00155A53 /* ViewController.m */; }; 12 | 4B97AB3720FC9ABF00155A53 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B97AB3520FC9ABF00155A53 /* Main.storyboard */; }; 13 | 4B97AB3920FC9AC100155A53 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B97AB3820FC9AC100155A53 /* Assets.xcassets */; }; 14 | 4B97AB3C20FC9AC100155A53 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B97AB3A20FC9AC100155A53 /* LaunchScreen.storyboard */; }; 15 | 4B97AB3F20FC9AC100155A53 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB3E20FC9AC100155A53 /* main.m */; }; 16 | 4B97AB4920FC9AC100155A53 /* ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB4820FC9AC100155A53 /* ExampleTests.m */; }; 17 | 4B97AB5420FC9AC100155A53 /* ExampleUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB5320FC9AC100155A53 /* ExampleUITests.m */; }; 18 | 4B97AB6320FC9B2A00155A53 /* ExampleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB6220FC9B2A00155A53 /* ExampleTableViewCell.m */; }; 19 | 4B97AB8C20FC9D9700155A53 /* UIImage+DDCornerRadius.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB8A20FC9D9700155A53 /* UIImage+DDCornerRadius.m */; }; 20 | 4B97AB8D20FC9D9700155A53 /* UIView+DDCornerRadius.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B97AB8B20FC9D9700155A53 /* UIView+DDCornerRadius.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 4B97AB4520FC9AC100155A53 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 4B97AB2420FC9ABF00155A53 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 4B97AB2B20FC9ABF00155A53; 29 | remoteInfo = Example; 30 | }; 31 | 4B97AB5020FC9AC100155A53 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 4B97AB2420FC9ABF00155A53 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 4B97AB2B20FC9ABF00155A53; 36 | remoteInfo = Example; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 4B97AB2C20FC9ABF00155A53 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 4B97AB2F20FC9ABF00155A53 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | 4B97AB3020FC9ABF00155A53 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | 4B97AB3220FC9ABF00155A53 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 45 | 4B97AB3320FC9ABF00155A53 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 46 | 4B97AB3620FC9ABF00155A53 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 4B97AB3820FC9AC100155A53 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 4B97AB3B20FC9AC100155A53 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 4B97AB3D20FC9AC100155A53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 4B97AB3E20FC9AC100155A53 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 51 | 4B97AB4420FC9AC100155A53 /* ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 4B97AB4820FC9AC100155A53 /* ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleTests.m; sourceTree = ""; }; 53 | 4B97AB4A20FC9AC100155A53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 4B97AB4F20FC9AC100155A53 /* ExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 4B97AB5320FC9AC100155A53 /* ExampleUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleUITests.m; sourceTree = ""; }; 56 | 4B97AB5520FC9AC100155A53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 4B97AB6120FC9B2A00155A53 /* ExampleTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExampleTableViewCell.h; sourceTree = ""; }; 58 | 4B97AB6220FC9B2A00155A53 /* ExampleTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleTableViewCell.m; sourceTree = ""; }; 59 | 4B97AB8720FC9D9700155A53 /* DDCornerRadius.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDCornerRadius.h; sourceTree = ""; }; 60 | 4B97AB8820FC9D9700155A53 /* UIImage+DDCornerRadius.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+DDCornerRadius.h"; sourceTree = ""; }; 61 | 4B97AB8920FC9D9700155A53 /* UIView+DDCornerRadius.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+DDCornerRadius.h"; sourceTree = ""; }; 62 | 4B97AB8A20FC9D9700155A53 /* UIImage+DDCornerRadius.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+DDCornerRadius.m"; sourceTree = ""; }; 63 | 4B97AB8B20FC9D9700155A53 /* UIView+DDCornerRadius.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+DDCornerRadius.m"; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 4B97AB2920FC9ABF00155A53 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 4B97AB4120FC9AC100155A53 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | 4B97AB4C20FC9AC100155A53 /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | /* End PBXFrameworksBuildPhase section */ 89 | 90 | /* Begin PBXGroup section */ 91 | 4B97AB2320FC9ABF00155A53 = { 92 | isa = PBXGroup; 93 | children = ( 94 | 4B97AB2E20FC9ABF00155A53 /* Example */, 95 | 4B97AB4720FC9AC100155A53 /* ExampleTests */, 96 | 4B97AB5220FC9AC100155A53 /* ExampleUITests */, 97 | 4B97AB2D20FC9ABF00155A53 /* Products */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | 4B97AB2D20FC9ABF00155A53 /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 4B97AB2C20FC9ABF00155A53 /* Example.app */, 105 | 4B97AB4420FC9AC100155A53 /* ExampleTests.xctest */, 106 | 4B97AB4F20FC9AC100155A53 /* ExampleUITests.xctest */, 107 | ); 108 | name = Products; 109 | sourceTree = ""; 110 | }; 111 | 4B97AB2E20FC9ABF00155A53 /* Example */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 4B97AB8620FC9D9700155A53 /* DDCornerRadius */, 115 | 4B97AB2F20FC9ABF00155A53 /* AppDelegate.h */, 116 | 4B97AB3020FC9ABF00155A53 /* AppDelegate.m */, 117 | 4B97AB3220FC9ABF00155A53 /* ViewController.h */, 118 | 4B97AB3320FC9ABF00155A53 /* ViewController.m */, 119 | 4B97AB6120FC9B2A00155A53 /* ExampleTableViewCell.h */, 120 | 4B97AB6220FC9B2A00155A53 /* ExampleTableViewCell.m */, 121 | 4B97AB3520FC9ABF00155A53 /* Main.storyboard */, 122 | 4B97AB3820FC9AC100155A53 /* Assets.xcassets */, 123 | 4B97AB3A20FC9AC100155A53 /* LaunchScreen.storyboard */, 124 | 4B97AB3D20FC9AC100155A53 /* Info.plist */, 125 | 4B97AB3E20FC9AC100155A53 /* main.m */, 126 | ); 127 | path = Example; 128 | sourceTree = ""; 129 | }; 130 | 4B97AB4720FC9AC100155A53 /* ExampleTests */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 4B97AB4820FC9AC100155A53 /* ExampleTests.m */, 134 | 4B97AB4A20FC9AC100155A53 /* Info.plist */, 135 | ); 136 | path = ExampleTests; 137 | sourceTree = ""; 138 | }; 139 | 4B97AB5220FC9AC100155A53 /* ExampleUITests */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 4B97AB5320FC9AC100155A53 /* ExampleUITests.m */, 143 | 4B97AB5520FC9AC100155A53 /* Info.plist */, 144 | ); 145 | path = ExampleUITests; 146 | sourceTree = ""; 147 | }; 148 | 4B97AB8620FC9D9700155A53 /* DDCornerRadius */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 4B97AB8720FC9D9700155A53 /* DDCornerRadius.h */, 152 | 4B97AB8820FC9D9700155A53 /* UIImage+DDCornerRadius.h */, 153 | 4B97AB8920FC9D9700155A53 /* UIView+DDCornerRadius.h */, 154 | 4B97AB8A20FC9D9700155A53 /* UIImage+DDCornerRadius.m */, 155 | 4B97AB8B20FC9D9700155A53 /* UIView+DDCornerRadius.m */, 156 | ); 157 | name = DDCornerRadius; 158 | path = ../../DDCornerRadius; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | 4B97AB2B20FC9ABF00155A53 /* Example */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = 4B97AB5820FC9AC100155A53 /* Build configuration list for PBXNativeTarget "Example" */; 167 | buildPhases = ( 168 | 4B97AB2820FC9ABF00155A53 /* Sources */, 169 | 4B97AB2920FC9ABF00155A53 /* Frameworks */, 170 | 4B97AB2A20FC9ABF00155A53 /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | ); 176 | name = Example; 177 | productName = Example; 178 | productReference = 4B97AB2C20FC9ABF00155A53 /* Example.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | 4B97AB4320FC9AC100155A53 /* ExampleTests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = 4B97AB5B20FC9AC100155A53 /* Build configuration list for PBXNativeTarget "ExampleTests" */; 184 | buildPhases = ( 185 | 4B97AB4020FC9AC100155A53 /* Sources */, 186 | 4B97AB4120FC9AC100155A53 /* Frameworks */, 187 | 4B97AB4220FC9AC100155A53 /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 4B97AB4620FC9AC100155A53 /* PBXTargetDependency */, 193 | ); 194 | name = ExampleTests; 195 | productName = ExampleTests; 196 | productReference = 4B97AB4420FC9AC100155A53 /* ExampleTests.xctest */; 197 | productType = "com.apple.product-type.bundle.unit-test"; 198 | }; 199 | 4B97AB4E20FC9AC100155A53 /* ExampleUITests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = 4B97AB5E20FC9AC100155A53 /* Build configuration list for PBXNativeTarget "ExampleUITests" */; 202 | buildPhases = ( 203 | 4B97AB4B20FC9AC100155A53 /* Sources */, 204 | 4B97AB4C20FC9AC100155A53 /* Frameworks */, 205 | 4B97AB4D20FC9AC100155A53 /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | 4B97AB5120FC9AC100155A53 /* PBXTargetDependency */, 211 | ); 212 | name = ExampleUITests; 213 | productName = ExampleUITests; 214 | productReference = 4B97AB4F20FC9AC100155A53 /* ExampleUITests.xctest */; 215 | productType = "com.apple.product-type.bundle.ui-testing"; 216 | }; 217 | /* End PBXNativeTarget section */ 218 | 219 | /* Begin PBXProject section */ 220 | 4B97AB2420FC9ABF00155A53 /* Project object */ = { 221 | isa = PBXProject; 222 | attributes = { 223 | LastUpgradeCheck = 0940; 224 | ORGANIZATIONNAME = chars; 225 | TargetAttributes = { 226 | 4B97AB2B20FC9ABF00155A53 = { 227 | CreatedOnToolsVersion = 9.4; 228 | }; 229 | 4B97AB4320FC9AC100155A53 = { 230 | CreatedOnToolsVersion = 9.4; 231 | TestTargetID = 4B97AB2B20FC9ABF00155A53; 232 | }; 233 | 4B97AB4E20FC9AC100155A53 = { 234 | CreatedOnToolsVersion = 9.4; 235 | TestTargetID = 4B97AB2B20FC9ABF00155A53; 236 | }; 237 | }; 238 | }; 239 | buildConfigurationList = 4B97AB2720FC9ABF00155A53 /* Build configuration list for PBXProject "Example" */; 240 | compatibilityVersion = "Xcode 9.3"; 241 | developmentRegion = en; 242 | hasScannedForEncodings = 0; 243 | knownRegions = ( 244 | en, 245 | Base, 246 | ); 247 | mainGroup = 4B97AB2320FC9ABF00155A53; 248 | productRefGroup = 4B97AB2D20FC9ABF00155A53 /* Products */; 249 | projectDirPath = ""; 250 | projectRoot = ""; 251 | targets = ( 252 | 4B97AB2B20FC9ABF00155A53 /* Example */, 253 | 4B97AB4320FC9AC100155A53 /* ExampleTests */, 254 | 4B97AB4E20FC9AC100155A53 /* ExampleUITests */, 255 | ); 256 | }; 257 | /* End PBXProject section */ 258 | 259 | /* Begin PBXResourcesBuildPhase section */ 260 | 4B97AB2A20FC9ABF00155A53 /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | 4B97AB3C20FC9AC100155A53 /* LaunchScreen.storyboard in Resources */, 265 | 4B97AB3920FC9AC100155A53 /* Assets.xcassets in Resources */, 266 | 4B97AB3720FC9ABF00155A53 /* Main.storyboard in Resources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | 4B97AB4220FC9AC100155A53 /* Resources */ = { 271 | isa = PBXResourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | }; 277 | 4B97AB4D20FC9AC100155A53 /* Resources */ = { 278 | isa = PBXResourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXResourcesBuildPhase section */ 285 | 286 | /* Begin PBXSourcesBuildPhase section */ 287 | 4B97AB2820FC9ABF00155A53 /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | 4B97AB6320FC9B2A00155A53 /* ExampleTableViewCell.m in Sources */, 292 | 4B97AB3420FC9ABF00155A53 /* ViewController.m in Sources */, 293 | 4B97AB3F20FC9AC100155A53 /* main.m in Sources */, 294 | 4B97AB8C20FC9D9700155A53 /* UIImage+DDCornerRadius.m in Sources */, 295 | 4B97AB3120FC9ABF00155A53 /* AppDelegate.m in Sources */, 296 | 4B97AB8D20FC9D9700155A53 /* UIView+DDCornerRadius.m in Sources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | 4B97AB4020FC9AC100155A53 /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 4B97AB4920FC9AC100155A53 /* ExampleTests.m in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | 4B97AB4B20FC9AC100155A53 /* Sources */ = { 309 | isa = PBXSourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | 4B97AB5420FC9AC100155A53 /* ExampleUITests.m in Sources */, 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | }; 316 | /* End PBXSourcesBuildPhase section */ 317 | 318 | /* Begin PBXTargetDependency section */ 319 | 4B97AB4620FC9AC100155A53 /* PBXTargetDependency */ = { 320 | isa = PBXTargetDependency; 321 | target = 4B97AB2B20FC9ABF00155A53 /* Example */; 322 | targetProxy = 4B97AB4520FC9AC100155A53 /* PBXContainerItemProxy */; 323 | }; 324 | 4B97AB5120FC9AC100155A53 /* PBXTargetDependency */ = { 325 | isa = PBXTargetDependency; 326 | target = 4B97AB2B20FC9ABF00155A53 /* Example */; 327 | targetProxy = 4B97AB5020FC9AC100155A53 /* PBXContainerItemProxy */; 328 | }; 329 | /* End PBXTargetDependency section */ 330 | 331 | /* Begin PBXVariantGroup section */ 332 | 4B97AB3520FC9ABF00155A53 /* Main.storyboard */ = { 333 | isa = PBXVariantGroup; 334 | children = ( 335 | 4B97AB3620FC9ABF00155A53 /* Base */, 336 | ); 337 | name = Main.storyboard; 338 | sourceTree = ""; 339 | }; 340 | 4B97AB3A20FC9AC100155A53 /* LaunchScreen.storyboard */ = { 341 | isa = PBXVariantGroup; 342 | children = ( 343 | 4B97AB3B20FC9AC100155A53 /* Base */, 344 | ); 345 | name = LaunchScreen.storyboard; 346 | sourceTree = ""; 347 | }; 348 | /* End PBXVariantGroup section */ 349 | 350 | /* Begin XCBuildConfiguration section */ 351 | 4B97AB5620FC9AC100155A53 /* Debug */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ALWAYS_SEARCH_USER_PATHS = NO; 355 | CLANG_ANALYZER_NONNULL = YES; 356 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 357 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 358 | CLANG_CXX_LIBRARY = "libc++"; 359 | CLANG_ENABLE_MODULES = YES; 360 | CLANG_ENABLE_OBJC_ARC = YES; 361 | CLANG_ENABLE_OBJC_WEAK = YES; 362 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 363 | CLANG_WARN_BOOL_CONVERSION = YES; 364 | CLANG_WARN_COMMA = YES; 365 | CLANG_WARN_CONSTANT_CONVERSION = YES; 366 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 367 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 368 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 369 | CLANG_WARN_EMPTY_BODY = YES; 370 | CLANG_WARN_ENUM_CONVERSION = YES; 371 | CLANG_WARN_INFINITE_RECURSION = YES; 372 | CLANG_WARN_INT_CONVERSION = YES; 373 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 374 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 375 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 376 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 377 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 378 | CLANG_WARN_STRICT_PROTOTYPES = YES; 379 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 380 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 381 | CLANG_WARN_UNREACHABLE_CODE = YES; 382 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 383 | CODE_SIGN_IDENTITY = "iPhone Developer"; 384 | COPY_PHASE_STRIP = NO; 385 | DEBUG_INFORMATION_FORMAT = dwarf; 386 | ENABLE_STRICT_OBJC_MSGSEND = YES; 387 | ENABLE_TESTABILITY = YES; 388 | GCC_C_LANGUAGE_STANDARD = gnu11; 389 | GCC_DYNAMIC_NO_PIC = NO; 390 | GCC_NO_COMMON_BLOCKS = YES; 391 | GCC_OPTIMIZATION_LEVEL = 0; 392 | GCC_PREPROCESSOR_DEFINITIONS = ( 393 | "DEBUG=1", 394 | "$(inherited)", 395 | ); 396 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 397 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 398 | GCC_WARN_UNDECLARED_SELECTOR = YES; 399 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 400 | GCC_WARN_UNUSED_FUNCTION = YES; 401 | GCC_WARN_UNUSED_VARIABLE = YES; 402 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 403 | MTL_ENABLE_DEBUG_INFO = YES; 404 | ONLY_ACTIVE_ARCH = YES; 405 | SDKROOT = iphoneos; 406 | }; 407 | name = Debug; 408 | }; 409 | 4B97AB5720FC9AC100155A53 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ALWAYS_SEARCH_USER_PATHS = NO; 413 | CLANG_ANALYZER_NONNULL = YES; 414 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 415 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 416 | CLANG_CXX_LIBRARY = "libc++"; 417 | CLANG_ENABLE_MODULES = YES; 418 | CLANG_ENABLE_OBJC_ARC = YES; 419 | CLANG_ENABLE_OBJC_WEAK = YES; 420 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 421 | CLANG_WARN_BOOL_CONVERSION = YES; 422 | CLANG_WARN_COMMA = YES; 423 | CLANG_WARN_CONSTANT_CONVERSION = YES; 424 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 425 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 426 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 427 | CLANG_WARN_EMPTY_BODY = YES; 428 | CLANG_WARN_ENUM_CONVERSION = YES; 429 | CLANG_WARN_INFINITE_RECURSION = YES; 430 | CLANG_WARN_INT_CONVERSION = YES; 431 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 432 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 433 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 434 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 435 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 436 | CLANG_WARN_STRICT_PROTOTYPES = YES; 437 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 438 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 439 | CLANG_WARN_UNREACHABLE_CODE = YES; 440 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 441 | CODE_SIGN_IDENTITY = "iPhone Developer"; 442 | COPY_PHASE_STRIP = NO; 443 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 444 | ENABLE_NS_ASSERTIONS = NO; 445 | ENABLE_STRICT_OBJC_MSGSEND = YES; 446 | GCC_C_LANGUAGE_STANDARD = gnu11; 447 | GCC_NO_COMMON_BLOCKS = YES; 448 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 449 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 450 | GCC_WARN_UNDECLARED_SELECTOR = YES; 451 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 452 | GCC_WARN_UNUSED_FUNCTION = YES; 453 | GCC_WARN_UNUSED_VARIABLE = YES; 454 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 455 | MTL_ENABLE_DEBUG_INFO = NO; 456 | SDKROOT = iphoneos; 457 | VALIDATE_PRODUCT = YES; 458 | }; 459 | name = Release; 460 | }; 461 | 4B97AB5920FC9AC100155A53 /* Debug */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 465 | CODE_SIGN_STYLE = Automatic; 466 | DEVELOPMENT_TEAM = W246LT7EDJ; 467 | INFOPLIST_FILE = Example/Info.plist; 468 | LD_RUNPATH_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "@executable_path/Frameworks", 471 | ); 472 | PRODUCT_BUNDLE_IDENTIFIER = cn.chars.Example; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | TARGETED_DEVICE_FAMILY = "1,2"; 475 | }; 476 | name = Debug; 477 | }; 478 | 4B97AB5A20FC9AC100155A53 /* Release */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 482 | CODE_SIGN_STYLE = Automatic; 483 | DEVELOPMENT_TEAM = W246LT7EDJ; 484 | INFOPLIST_FILE = Example/Info.plist; 485 | LD_RUNPATH_SEARCH_PATHS = ( 486 | "$(inherited)", 487 | "@executable_path/Frameworks", 488 | ); 489 | PRODUCT_BUNDLE_IDENTIFIER = cn.chars.Example; 490 | PRODUCT_NAME = "$(TARGET_NAME)"; 491 | TARGETED_DEVICE_FAMILY = "1,2"; 492 | }; 493 | name = Release; 494 | }; 495 | 4B97AB5C20FC9AC100155A53 /* Debug */ = { 496 | isa = XCBuildConfiguration; 497 | buildSettings = { 498 | BUNDLE_LOADER = "$(TEST_HOST)"; 499 | CODE_SIGN_STYLE = Automatic; 500 | DEVELOPMENT_TEAM = W246LT7EDJ; 501 | INFOPLIST_FILE = ExampleTests/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "@executable_path/Frameworks", 505 | "@loader_path/Frameworks", 506 | ); 507 | PRODUCT_BUNDLE_IDENTIFIER = cn.chars.ExampleTests; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | TARGETED_DEVICE_FAMILY = "1,2"; 510 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 511 | }; 512 | name = Debug; 513 | }; 514 | 4B97AB5D20FC9AC100155A53 /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | BUNDLE_LOADER = "$(TEST_HOST)"; 518 | CODE_SIGN_STYLE = Automatic; 519 | DEVELOPMENT_TEAM = W246LT7EDJ; 520 | INFOPLIST_FILE = ExampleTests/Info.plist; 521 | LD_RUNPATH_SEARCH_PATHS = ( 522 | "$(inherited)", 523 | "@executable_path/Frameworks", 524 | "@loader_path/Frameworks", 525 | ); 526 | PRODUCT_BUNDLE_IDENTIFIER = cn.chars.ExampleTests; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | TARGETED_DEVICE_FAMILY = "1,2"; 529 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 530 | }; 531 | name = Release; 532 | }; 533 | 4B97AB5F20FC9AC100155A53 /* Debug */ = { 534 | isa = XCBuildConfiguration; 535 | buildSettings = { 536 | CODE_SIGN_STYLE = Automatic; 537 | DEVELOPMENT_TEAM = W246LT7EDJ; 538 | INFOPLIST_FILE = ExampleUITests/Info.plist; 539 | LD_RUNPATH_SEARCH_PATHS = ( 540 | "$(inherited)", 541 | "@executable_path/Frameworks", 542 | "@loader_path/Frameworks", 543 | ); 544 | PRODUCT_BUNDLE_IDENTIFIER = cn.chars.ExampleUITests; 545 | PRODUCT_NAME = "$(TARGET_NAME)"; 546 | TARGETED_DEVICE_FAMILY = "1,2"; 547 | TEST_TARGET_NAME = Example; 548 | }; 549 | name = Debug; 550 | }; 551 | 4B97AB6020FC9AC100155A53 /* Release */ = { 552 | isa = XCBuildConfiguration; 553 | buildSettings = { 554 | CODE_SIGN_STYLE = Automatic; 555 | DEVELOPMENT_TEAM = W246LT7EDJ; 556 | INFOPLIST_FILE = ExampleUITests/Info.plist; 557 | LD_RUNPATH_SEARCH_PATHS = ( 558 | "$(inherited)", 559 | "@executable_path/Frameworks", 560 | "@loader_path/Frameworks", 561 | ); 562 | PRODUCT_BUNDLE_IDENTIFIER = cn.chars.ExampleUITests; 563 | PRODUCT_NAME = "$(TARGET_NAME)"; 564 | TARGETED_DEVICE_FAMILY = "1,2"; 565 | TEST_TARGET_NAME = Example; 566 | }; 567 | name = Release; 568 | }; 569 | /* End XCBuildConfiguration section */ 570 | 571 | /* Begin XCConfigurationList section */ 572 | 4B97AB2720FC9ABF00155A53 /* Build configuration list for PBXProject "Example" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | 4B97AB5620FC9AC100155A53 /* Debug */, 576 | 4B97AB5720FC9AC100155A53 /* Release */, 577 | ); 578 | defaultConfigurationIsVisible = 0; 579 | defaultConfigurationName = Release; 580 | }; 581 | 4B97AB5820FC9AC100155A53 /* Build configuration list for PBXNativeTarget "Example" */ = { 582 | isa = XCConfigurationList; 583 | buildConfigurations = ( 584 | 4B97AB5920FC9AC100155A53 /* Debug */, 585 | 4B97AB5A20FC9AC100155A53 /* Release */, 586 | ); 587 | defaultConfigurationIsVisible = 0; 588 | defaultConfigurationName = Release; 589 | }; 590 | 4B97AB5B20FC9AC100155A53 /* Build configuration list for PBXNativeTarget "ExampleTests" */ = { 591 | isa = XCConfigurationList; 592 | buildConfigurations = ( 593 | 4B97AB5C20FC9AC100155A53 /* Debug */, 594 | 4B97AB5D20FC9AC100155A53 /* Release */, 595 | ); 596 | defaultConfigurationIsVisible = 0; 597 | defaultConfigurationName = Release; 598 | }; 599 | 4B97AB5E20FC9AC100155A53 /* Build configuration list for PBXNativeTarget "ExampleUITests" */ = { 600 | isa = XCConfigurationList; 601 | buildConfigurations = ( 602 | 4B97AB5F20FC9AC100155A53 /* Debug */, 603 | 4B97AB6020FC9AC100155A53 /* Release */, 604 | ); 605 | defaultConfigurationIsVisible = 0; 606 | defaultConfigurationName = Release; 607 | }; 608 | /* End XCConfigurationList section */ 609 | }; 610 | rootObject = 4B97AB2420FC9ABF00155A53 /* Project object */; 611 | } 612 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Example 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Example 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | 22 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 23 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]]; 24 | self.window.rootViewController = nav; 25 | [self.window makeKeyAndVisible]; 26 | 27 | return YES; 28 | } 29 | 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application { 32 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 33 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 34 | } 35 | 36 | 37 | - (void)applicationDidEnterBackground:(UIApplication *)application { 38 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 39 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | } 41 | 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application { 44 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 45 | } 46 | 47 | 48 | - (void)applicationDidBecomeActive:(UIApplication *)application { 49 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 50 | } 51 | 52 | 53 | - (void)applicationWillTerminate:(UIApplication *)application { 54 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 55 | } 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/demo1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "demo1.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/demo1.imageset/demo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/DDCornerRadius/5af73680c61ce989f5310b508cba88f9c47f48d2/Example/Example/Assets.xcassets/demo1.imageset/demo1.jpg -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/demo2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "demo2.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/demo2.imageset/demo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/DDCornerRadius/5af73680c61ce989f5310b508cba88f9c47f48d2/Example/Example/Assets.xcassets/demo2.imageset/demo2.jpg -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/demo3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "demo3.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/demo3.imageset/demo3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/DDCornerRadius/5af73680c61ce989f5310b508cba88f9c47f48d2/Example/Example/Assets.xcassets/demo3.imageset/demo3.jpg -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Example/Example/ExampleTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleTableViewCell.h 3 | // Example 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ExampleTableViewCell : UITableViewCell 12 | 13 | @property (nonatomic) UIImageView *leftImageView; 14 | @property (nonatomic) UIImageView *centerImageView; 15 | @property (nonatomic) UIImageView *rightImageView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Example/ExampleTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleTableViewCell.m 3 | // Example 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import "ExampleTableViewCell.h" 10 | #import "DDCornerRadius.h" 11 | 12 | #define WIDTH_AND_HEIGHT_SCALE (3.0 / 2.0) 13 | #define CONTENT_INSET 10.0 14 | 15 | @implementation ExampleTableViewCell 16 | 17 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 18 | { 19 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 20 | if (self) { 21 | [self addSubview:self.leftImageView]; 22 | [self addSubview:self.centerImageView]; 23 | [self addSubview:self.rightImageView]; 24 | } 25 | return self; 26 | } 27 | 28 | - (UIImageView *)leftImageView 29 | { 30 | if (!_leftImageView) { 31 | _leftImageView = [[UIImageView alloc] init]; 32 | _leftImageView.image = [UIImage imageNamed:@"demo1"]; 33 | } 34 | return _leftImageView; 35 | } 36 | 37 | - (UIImageView *)centerImageView 38 | { 39 | if (!_centerImageView) { 40 | _centerImageView = [[UIImageView alloc] init]; 41 | _centerImageView.image = [UIImage imageNamed:@"demo2"]; 42 | _centerImageView.layer.cornerRadius = 10.0; 43 | _centerImageView.clipsToBounds = YES; 44 | _centerImageView.backgroundColor = [UIColor blackColor]; 45 | } 46 | return _centerImageView; 47 | } 48 | 49 | 50 | - (UIImageView *)rightImageView 51 | { 52 | if (!_rightImageView) { 53 | _rightImageView = [[UIImageView alloc] init]; 54 | } 55 | return _rightImageView; 56 | } 57 | 58 | - (void)layoutSubviews 59 | { 60 | [super layoutSubviews]; 61 | 62 | CGSize size = self.bounds.size; 63 | CGFloat imageH = size.height - CONTENT_INSET * 2; 64 | CGFloat imageW = imageH * WIDTH_AND_HEIGHT_SCALE; 65 | self.leftImageView.frame = CGRectMake(CONTENT_INSET, CONTENT_INSET, imageW, imageH); 66 | CGFloat centerImageX = (size.width - imageW * 3 - CONTENT_INSET * 2) / 2.0 + CONTENT_INSET + imageW; 67 | self.centerImageView.frame = CGRectMake(centerImageX, CONTENT_INSET, imageW, imageH); 68 | self.rightImageView.frame = CGRectMake(size.width - CONTENT_INSET - imageW, CONTENT_INSET, imageW, imageH); 69 | self.rightImageView.image = [[UIImage imageNamed:@"demo3"] dd_imageByCornerRadius:10.0 scaleSize:CGSizeMake(imageH, imageH) borderWidth:1.0 borderColor:[UIColor redColor] corners:(UIRectCornerTopLeft | UIRectCornerBottomRight)]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Example/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/Example/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Example 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Example/Example/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Example 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "ExampleTableViewCell.h" 11 | 12 | #define CELL_HEIGHT 80.0 13 | 14 | @interface ViewController () 15 | 16 | @property (nonatomic) UITableView *tableView; 17 | 18 | @end 19 | 20 | @interface ViewController () 21 | 22 | @end 23 | 24 | @implementation ViewController 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | // Do any additional setup after loading the view, typically from a nib. 30 | 31 | [self.view addSubview:self.tableView]; 32 | } 33 | 34 | - (UITableView *)tableView 35 | { 36 | if (!_tableView) { 37 | _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; 38 | _tableView.dataSource = self; 39 | _tableView.delegate = self; 40 | } 41 | return _tableView; 42 | } 43 | 44 | #pragma mark - UITableViewDataSource 45 | 46 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 47 | { 48 | return 20; 49 | } 50 | 51 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 52 | { 53 | return 50.0; 54 | } 55 | 56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 57 | { 58 | static NSString *cellId = @"ViewControllerCellId"; 59 | ExampleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; 60 | if (!cell) { 61 | cell = [[ExampleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; 62 | } 63 | return cell; 64 | } 65 | 66 | #pragma mark - UITableViewDelegate 67 | 68 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 69 | { 70 | return CELL_HEIGHT; 71 | } 72 | 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Example/Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Example 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/ExampleTests/ExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleTests.m 3 | // ExampleTests 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ExampleTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Example/ExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/ExampleUITests/ExampleUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleUITests.m 3 | // ExampleUITests 4 | // 5 | // Created by chars on 2018/7/16. 6 | // Copyright © 2018年 chars. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ExampleUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ExampleUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/ExampleUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Chars 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DDCornerRadius 2 | 3 | [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat 4 | )](http://mit-license.org) 5 | [![Platform](http://img.shields.io/badge/platform-ios-lightgrey.svg?style=flat 6 | )](https://developer.apple.com/resources/) 7 | ![Language](http://img.shields.io/badge/language-Objc-orange.svg?style=flat 8 | ) 9 | 10 | [![Issues](https://img.shields.io/github/issues/charsdavy/DDCornerRadius.svg?style=flat 11 | )](https://github.com/charsdavy/DDCornerRadius/issues) 12 | [![Cocoapod](http://img.shields.io/cocoapods/v/SwiftyStoreKit.svg?style=flat)](http://cocoadocs.org/docsets/SwiftyStoreKit/) 13 | 14 | Optimize image fillet processing to avoid performance loss caused by off-screen rendering and optimize the stuck phenomenon. 15 | 16 | ## Installation 17 | 18 | ### CocoaPods 19 | 20 | [CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects. You can install it with the following command: 21 | 22 | ```bash 23 | $ gem install cocoapods 24 | ``` 25 | 26 | To integrate DDCornerRadius into your Xcode project using CocoaPods, specify it to a target in your `Podfile`: 27 | 28 | ```bash 29 | source 'https://github.com/CocoaPods/Specs.git' 30 | platform :ios, '8.0' 31 | use_frameworks! 32 | 33 | target 'MyApp' do 34 | # your other pod 35 | # ... 36 | pod 'DDCornerRadius', '~> 1.0' 37 | end 38 | ``` 39 | 40 | Then, run the following command: 41 | 42 | ```bash 43 | $ pod install 44 | ``` 45 | 46 | You should open the `{Project}.xcworkspace` instead of the `{Project}.xcodeproj` after you installed anything from CocoaPods. 47 | 48 | For more information about how to use CocoaPods, I suggest [this tutorial](https://www.raywenderlich.com/156971/cocoapods-tutorial-swift-getting-started). 49 | 50 | # Usage 51 | 52 | import header file: 53 | 54 | ``` 55 | #import "DDCornerRadius.h" 56 | ``` 57 | 58 | plan 1: 59 | 60 | ``` 61 | imageView.image = [[UIImage imageNamed:@"demo3"] dd_imageByCornerRadius:40.0 corners:(UIRectCornerTopLeft | UIRectCornerBottomRight) borderWidth:5.0 borderColor:[UIColor redColor]]; 62 | ``` 63 | 64 | plan 2: 65 | 66 | ``` 67 | imageView = [UIImageView dd_cornerWithRadius:40.0 cornerColor:[UIColor redColor] corners:(UIRectCornerTopLeft | UIRectCornerBottomRight) ]; 68 | ``` 69 | # ScreenShot 70 | 71 | ![ScreenShot](./Screenshot.gif) 72 | -------------------------------------------------------------------------------- /Screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/DDCornerRadius/5af73680c61ce989f5310b508cba88f9c47f48d2/Screenshot.gif --------------------------------------------------------------------------------