├── README.md ├── UIViewRoundedCorners.xcodeproj ├── project.pbxproj └── xcuserdata │ └── Jogi.xcuserdatad │ └── xcschemes │ ├── UIViewRoundedCorners.xcscheme │ └── xcschememanagement.plist └── UIViewRoundedCorners ├── AppDelegate.h ├── AppDelegate.m ├── UIView+RoundedCorners.h ├── UIView+RoundedCorners.m ├── UIViewRoundedCorners-Info.plist ├── UIViewRoundedCorners-Prefix.pch ├── ViewController.h ├── ViewController.m ├── en.lproj ├── InfoPlist.strings └── ViewController.xib └── main.m /README.md: -------------------------------------------------------------------------------- 1 | UIView+RoundedCorners category 2 | ================ 3 | This adds rounded corners to just the corners which you want rounded not all of them like the new `CALayer cornerRadius`. 4 | 5 | Usage 6 | ================ 7 | Import the category first: 8 | 9 | `#import UIView+RoundedCorners.h` 10 | 11 | Use the following to round all corners: 12 | 13 | `[myView setRoundedCorners:UIRectCornerAllCorners radius:10.0];` 14 | 15 | For Top Left and Top Right: 16 | 17 | `[myView setRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight radius:10.0];` 18 | 19 | Here I have used the inbuilt enum `UIRectCorner` for specifying the rounded corners. So its much simpler to implement. 20 | 21 | Support 22 | ================ 23 | iOS 5 only for demo as I am using ARC, but the core UIView category should work with iOS 3.2+ 24 | 25 | License 26 | ================ 27 | [Under a Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/) -------------------------------------------------------------------------------- /UIViewRoundedCorners.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D490C8B214799BA30072E9E0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D490C8B114799BA30072E9E0 /* UIKit.framework */; }; 11 | D490C8B414799BA30072E9E0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D490C8B314799BA30072E9E0 /* Foundation.framework */; }; 12 | D490C8B614799BA30072E9E0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D490C8B514799BA30072E9E0 /* CoreGraphics.framework */; }; 13 | D490C8BC14799BA30072E9E0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D490C8BA14799BA30072E9E0 /* InfoPlist.strings */; }; 14 | D490C8BE14799BA30072E9E0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D490C8BD14799BA30072E9E0 /* main.m */; }; 15 | D490C8C214799BA30072E9E0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D490C8C114799BA30072E9E0 /* AppDelegate.m */; }; 16 | D490C8C514799BA30072E9E0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D490C8C414799BA30072E9E0 /* ViewController.m */; }; 17 | D490C8C814799BA30072E9E0 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D490C8C614799BA30072E9E0 /* ViewController.xib */; }; 18 | D490C8D014799BC60072E9E0 /* UIView+RoundedCorners.m in Sources */ = {isa = PBXBuildFile; fileRef = D490C8CF14799BC60072E9E0 /* UIView+RoundedCorners.m */; }; 19 | D490C8D21479A02F0072E9E0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D490C8D11479A02F0072E9E0 /* QuartzCore.framework */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | D490C8AD14799BA30072E9E0 /* UIViewRoundedCorners.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIViewRoundedCorners.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | D490C8B114799BA30072E9E0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 25 | D490C8B314799BA30072E9E0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 26 | D490C8B514799BA30072E9E0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 27 | D490C8B914799BA30072E9E0 /* UIViewRoundedCorners-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UIViewRoundedCorners-Info.plist"; sourceTree = ""; }; 28 | D490C8BB14799BA30072E9E0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 29 | D490C8BD14799BA30072E9E0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 30 | D490C8BF14799BA30072E9E0 /* UIViewRoundedCorners-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewRoundedCorners-Prefix.pch"; sourceTree = ""; }; 31 | D490C8C014799BA30072E9E0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 32 | D490C8C114799BA30072E9E0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 33 | D490C8C314799BA30072E9E0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 34 | D490C8C414799BA30072E9E0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 35 | D490C8C714799BA30072E9E0 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; 36 | D490C8CE14799BC60072E9E0 /* UIView+RoundedCorners.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+RoundedCorners.h"; sourceTree = ""; }; 37 | D490C8CF14799BC60072E9E0 /* UIView+RoundedCorners.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+RoundedCorners.m"; sourceTree = ""; }; 38 | D490C8D11479A02F0072E9E0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | D490C8AA14799BA30072E9E0 /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | D490C8D21479A02F0072E9E0 /* QuartzCore.framework in Frameworks */, 47 | D490C8B214799BA30072E9E0 /* UIKit.framework in Frameworks */, 48 | D490C8B414799BA30072E9E0 /* Foundation.framework in Frameworks */, 49 | D490C8B614799BA30072E9E0 /* CoreGraphics.framework in Frameworks */, 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXFrameworksBuildPhase section */ 54 | 55 | /* Begin PBXGroup section */ 56 | D490C8A214799BA30072E9E0 = { 57 | isa = PBXGroup; 58 | children = ( 59 | D490C8B714799BA30072E9E0 /* UIViewRoundedCorners */, 60 | D490C8B014799BA30072E9E0 /* Frameworks */, 61 | D490C8AE14799BA30072E9E0 /* Products */, 62 | ); 63 | sourceTree = ""; 64 | }; 65 | D490C8AE14799BA30072E9E0 /* Products */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | D490C8AD14799BA30072E9E0 /* UIViewRoundedCorners.app */, 69 | ); 70 | name = Products; 71 | sourceTree = ""; 72 | }; 73 | D490C8B014799BA30072E9E0 /* Frameworks */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | D490C8D11479A02F0072E9E0 /* QuartzCore.framework */, 77 | D490C8B114799BA30072E9E0 /* UIKit.framework */, 78 | D490C8B314799BA30072E9E0 /* Foundation.framework */, 79 | D490C8B514799BA30072E9E0 /* CoreGraphics.framework */, 80 | ); 81 | name = Frameworks; 82 | sourceTree = ""; 83 | }; 84 | D490C8B714799BA30072E9E0 /* UIViewRoundedCorners */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | D490C8D41479A43E0072E9E0 /* Demo */, 88 | D490C8D31479A3450072E9E0 /* UIView+RoundedCorners */, 89 | ); 90 | path = UIViewRoundedCorners; 91 | sourceTree = ""; 92 | }; 93 | D490C8B814799BA30072E9E0 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | D490C8B914799BA30072E9E0 /* UIViewRoundedCorners-Info.plist */, 97 | D490C8BA14799BA30072E9E0 /* InfoPlist.strings */, 98 | D490C8BD14799BA30072E9E0 /* main.m */, 99 | D490C8BF14799BA30072E9E0 /* UIViewRoundedCorners-Prefix.pch */, 100 | ); 101 | name = "Supporting Files"; 102 | sourceTree = ""; 103 | }; 104 | D490C8D31479A3450072E9E0 /* UIView+RoundedCorners */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | D490C8CE14799BC60072E9E0 /* UIView+RoundedCorners.h */, 108 | D490C8CF14799BC60072E9E0 /* UIView+RoundedCorners.m */, 109 | ); 110 | name = "UIView+RoundedCorners"; 111 | sourceTree = ""; 112 | }; 113 | D490C8D41479A43E0072E9E0 /* Demo */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | D490C8C014799BA30072E9E0 /* AppDelegate.h */, 117 | D490C8C114799BA30072E9E0 /* AppDelegate.m */, 118 | D490C8C314799BA30072E9E0 /* ViewController.h */, 119 | D490C8C414799BA30072E9E0 /* ViewController.m */, 120 | D490C8C614799BA30072E9E0 /* ViewController.xib */, 121 | D490C8B814799BA30072E9E0 /* Supporting Files */, 122 | ); 123 | name = Demo; 124 | sourceTree = ""; 125 | }; 126 | /* End PBXGroup section */ 127 | 128 | /* Begin PBXNativeTarget section */ 129 | D490C8AC14799BA30072E9E0 /* UIViewRoundedCorners */ = { 130 | isa = PBXNativeTarget; 131 | buildConfigurationList = D490C8CB14799BA30072E9E0 /* Build configuration list for PBXNativeTarget "UIViewRoundedCorners" */; 132 | buildPhases = ( 133 | D490C8A914799BA30072E9E0 /* Sources */, 134 | D490C8AA14799BA30072E9E0 /* Frameworks */, 135 | D490C8AB14799BA30072E9E0 /* Resources */, 136 | ); 137 | buildRules = ( 138 | ); 139 | dependencies = ( 140 | ); 141 | name = UIViewRoundedCorners; 142 | productName = UIViewRoundedCorners; 143 | productReference = D490C8AD14799BA30072E9E0 /* UIViewRoundedCorners.app */; 144 | productType = "com.apple.product-type.application"; 145 | }; 146 | /* End PBXNativeTarget section */ 147 | 148 | /* Begin PBXProject section */ 149 | D490C8A414799BA30072E9E0 /* Project object */ = { 150 | isa = PBXProject; 151 | attributes = { 152 | LastUpgradeCheck = 0420; 153 | }; 154 | buildConfigurationList = D490C8A714799BA30072E9E0 /* Build configuration list for PBXProject "UIViewRoundedCorners" */; 155 | compatibilityVersion = "Xcode 3.2"; 156 | developmentRegion = English; 157 | hasScannedForEncodings = 0; 158 | knownRegions = ( 159 | en, 160 | ); 161 | mainGroup = D490C8A214799BA30072E9E0; 162 | productRefGroup = D490C8AE14799BA30072E9E0 /* Products */; 163 | projectDirPath = ""; 164 | projectRoot = ""; 165 | targets = ( 166 | D490C8AC14799BA30072E9E0 /* UIViewRoundedCorners */, 167 | ); 168 | }; 169 | /* End PBXProject section */ 170 | 171 | /* Begin PBXResourcesBuildPhase section */ 172 | D490C8AB14799BA30072E9E0 /* Resources */ = { 173 | isa = PBXResourcesBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | D490C8BC14799BA30072E9E0 /* InfoPlist.strings in Resources */, 177 | D490C8C814799BA30072E9E0 /* ViewController.xib in Resources */, 178 | ); 179 | runOnlyForDeploymentPostprocessing = 0; 180 | }; 181 | /* End PBXResourcesBuildPhase section */ 182 | 183 | /* Begin PBXSourcesBuildPhase section */ 184 | D490C8A914799BA30072E9E0 /* Sources */ = { 185 | isa = PBXSourcesBuildPhase; 186 | buildActionMask = 2147483647; 187 | files = ( 188 | D490C8BE14799BA30072E9E0 /* main.m in Sources */, 189 | D490C8C214799BA30072E9E0 /* AppDelegate.m in Sources */, 190 | D490C8C514799BA30072E9E0 /* ViewController.m in Sources */, 191 | D490C8D014799BC60072E9E0 /* UIView+RoundedCorners.m in Sources */, 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | /* End PBXSourcesBuildPhase section */ 196 | 197 | /* Begin PBXVariantGroup section */ 198 | D490C8BA14799BA30072E9E0 /* InfoPlist.strings */ = { 199 | isa = PBXVariantGroup; 200 | children = ( 201 | D490C8BB14799BA30072E9E0 /* en */, 202 | ); 203 | name = InfoPlist.strings; 204 | sourceTree = ""; 205 | }; 206 | D490C8C614799BA30072E9E0 /* ViewController.xib */ = { 207 | isa = PBXVariantGroup; 208 | children = ( 209 | D490C8C714799BA30072E9E0 /* en */, 210 | ); 211 | name = ViewController.xib; 212 | sourceTree = ""; 213 | }; 214 | /* End PBXVariantGroup section */ 215 | 216 | /* Begin XCBuildConfiguration section */ 217 | D490C8C914799BA30072E9E0 /* Debug */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | ALWAYS_SEARCH_USER_PATHS = NO; 221 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 222 | CLANG_ENABLE_OBJC_ARC = YES; 223 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 224 | COPY_PHASE_STRIP = NO; 225 | GCC_C_LANGUAGE_STANDARD = gnu99; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_OPTIMIZATION_LEVEL = 0; 228 | GCC_PREPROCESSOR_DEFINITIONS = ( 229 | "DEBUG=1", 230 | "$(inherited)", 231 | ); 232 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 233 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 234 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 238 | SDKROOT = iphoneos; 239 | }; 240 | name = Debug; 241 | }; 242 | D490C8CA14799BA30072E9E0 /* Release */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ALWAYS_SEARCH_USER_PATHS = NO; 246 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 249 | COPY_PHASE_STRIP = YES; 250 | GCC_C_LANGUAGE_STANDARD = gnu99; 251 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 252 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 253 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 256 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 257 | SDKROOT = iphoneos; 258 | VALIDATE_PRODUCT = YES; 259 | }; 260 | name = Release; 261 | }; 262 | D490C8CC14799BA30072E9E0 /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 266 | GCC_PREFIX_HEADER = "UIViewRoundedCorners/UIViewRoundedCorners-Prefix.pch"; 267 | INFOPLIST_FILE = "UIViewRoundedCorners/UIViewRoundedCorners-Info.plist"; 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | WRAPPER_EXTENSION = app; 270 | }; 271 | name = Debug; 272 | }; 273 | D490C8CD14799BA30072E9E0 /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 277 | GCC_PREFIX_HEADER = "UIViewRoundedCorners/UIViewRoundedCorners-Prefix.pch"; 278 | INFOPLIST_FILE = "UIViewRoundedCorners/UIViewRoundedCorners-Info.plist"; 279 | PRODUCT_NAME = "$(TARGET_NAME)"; 280 | WRAPPER_EXTENSION = app; 281 | }; 282 | name = Release; 283 | }; 284 | /* End XCBuildConfiguration section */ 285 | 286 | /* Begin XCConfigurationList section */ 287 | D490C8A714799BA30072E9E0 /* Build configuration list for PBXProject "UIViewRoundedCorners" */ = { 288 | isa = XCConfigurationList; 289 | buildConfigurations = ( 290 | D490C8C914799BA30072E9E0 /* Debug */, 291 | D490C8CA14799BA30072E9E0 /* Release */, 292 | ); 293 | defaultConfigurationIsVisible = 0; 294 | defaultConfigurationName = Release; 295 | }; 296 | D490C8CB14799BA30072E9E0 /* Build configuration list for PBXNativeTarget "UIViewRoundedCorners" */ = { 297 | isa = XCConfigurationList; 298 | buildConfigurations = ( 299 | D490C8CC14799BA30072E9E0 /* Debug */, 300 | D490C8CD14799BA30072E9E0 /* Release */, 301 | ); 302 | defaultConfigurationIsVisible = 0; 303 | }; 304 | /* End XCConfigurationList section */ 305 | }; 306 | rootObject = D490C8A414799BA30072E9E0 /* Project object */; 307 | } 308 | -------------------------------------------------------------------------------- /UIViewRoundedCorners.xcodeproj/xcuserdata/Jogi.xcuserdatad/xcschemes/UIViewRoundedCorners.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 49 | 50 | 56 | 57 | 58 | 59 | 60 | 61 | 67 | 68 | 74 | 75 | 76 | 77 | 79 | 80 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /UIViewRoundedCorners.xcodeproj/xcuserdata/Jogi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | UIViewRoundedCorners.xcscheme 8 | 9 | orderHint 10 | 2 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D490C8AC14799BA30072E9E0 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // UIViewRoundedCorners 4 | // 5 | // Created by Vashishtha Jogi on 11/20/11. 6 | // Copyright (c) 2011 Vashishtha Jogi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) ViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // UIViewRoundedCorners 4 | // 5 | // Created by Vashishtha Jogi on 11/20/11. 6 | // Copyright (c) 2011 Vashishtha Jogi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | // Override point for customization after application launch. 22 | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; 23 | self.window.rootViewController = self.viewController; 24 | [self.window makeKeyAndVisible]; 25 | return YES; 26 | } 27 | 28 | - (void)applicationWillResignActive:(UIApplication *)application 29 | { 30 | /* 31 | 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. 32 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 33 | */ 34 | } 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application 37 | { 38 | /* 39 | 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. 40 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | */ 42 | } 43 | 44 | - (void)applicationWillEnterForeground:(UIApplication *)application 45 | { 46 | /* 47 | Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 48 | */ 49 | } 50 | 51 | - (void)applicationDidBecomeActive:(UIApplication *)application 52 | { 53 | /* 54 | 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. 55 | */ 56 | } 57 | 58 | - (void)applicationWillTerminate:(UIApplication *)application 59 | { 60 | /* 61 | Called when the application is about to terminate. 62 | Save data if appropriate. 63 | See also applicationDidEnterBackground:. 64 | */ 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/UIView+RoundedCorners.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+RoundedCorners.h 3 | // UIViewRoundedCorners 4 | // 5 | // Created by Vashishtha Jogi on 11/20/11. 6 | // Copyright (c) 2011 Vashishtha Jogi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (RoundedCorners) 12 | 13 | -(void)setRoundedCorners:(UIRectCorner)corners radius:(CGFloat)radius; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/UIView+RoundedCorners.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+RoundedCorners.m 3 | // UIViewRoundedCorners 4 | // 5 | // Created by Vashishtha Jogi on 11/20/11. 6 | // Copyright (c) 2011 Vashishtha Jogi. All rights reserved. 7 | // 8 | 9 | #import "UIView+RoundedCorners.h" 10 | #import 11 | 12 | @implementation UIView (RoundedCorners) 13 | 14 | -(void)setRoundedCorners:(UIRectCorner)corners radius:(CGFloat)radius { 15 | CGRect rect = self.bounds; 16 | 17 | // Create the path 18 | UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:rect 19 | byRoundingCorners:corners 20 | cornerRadii:CGSizeMake(radius, radius)]; 21 | 22 | // Create the shape layer and set its path 23 | CAShapeLayer *maskLayer = [CAShapeLayer layer]; 24 | maskLayer.frame = rect; 25 | maskLayer.path = maskPath.CGPath; 26 | 27 | // Set the newly created shape layer as the mask for the view's layer 28 | self.layer.mask = maskLayer; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/UIViewRoundedCorners-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | com.jogi.uiviewr.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/UIViewRoundedCorners-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'UIViewRoundedCorners' target in the 'UIViewRoundedCorners' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // UIViewRoundedCorners 4 | // 5 | // Created by Vashishtha Jogi on 11/20/11. 6 | // Copyright (c) 2011 Vashishtha Jogi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | { 13 | UIView *viewNone; 14 | UIView *viewTopLeft; 15 | UIView *viewTopRight; 16 | UIView *viewBottomLeft; 17 | UIView *viewBottomRight; 18 | UIView *viewall; 19 | UIView *viewTopLeftRight; 20 | } 21 | 22 | @property(nonatomic, strong) IBOutlet UIView *viewNone; 23 | @property(nonatomic, strong) IBOutlet UIView *viewTopLeft; 24 | @property(nonatomic, strong) IBOutlet UIView *viewTopRight; 25 | @property(nonatomic, strong) IBOutlet UIView *viewBottomLeft; 26 | @property(nonatomic, strong) IBOutlet UIView *viewBottomRight; 27 | @property(nonatomic, strong) IBOutlet UIView *viewAll; 28 | @property(nonatomic, strong) IBOutlet UIView *viewTopLeftRight; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // UIViewRoundedCorners 4 | // 5 | // Created by Vashishtha Jogi on 11/20/11. 6 | // Copyright (c) 2011 Vashishtha Jogi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "UIView+RoundedCorners.h" 11 | 12 | @implementation ViewController 13 | @synthesize viewNone, viewTopLeft, viewTopRight, viewBottomLeft, viewBottomRight, viewAll, viewTopLeftRight; 14 | 15 | - (void)didReceiveMemoryWarning 16 | { 17 | [super didReceiveMemoryWarning]; 18 | // Release any cached data, images, etc that aren't in use. 19 | } 20 | 21 | #pragma mark - View lifecycle 22 | 23 | - (void)viewDidLoad 24 | { 25 | [super viewDidLoad]; 26 | // Do any additional setup after loading the view, typically from a nib. 27 | 28 | [viewTopLeft setRoundedCorners:UIRectCornerTopLeft radius:10.0]; 29 | [viewTopRight setRoundedCorners:UIRectCornerTopRight radius:10.0]; 30 | [viewBottomLeft setRoundedCorners:UIRectCornerBottomLeft radius:10.0]; 31 | [viewBottomRight setRoundedCorners:UIRectCornerBottomRight radius:10.0]; 32 | [viewAll setRoundedCorners:UIRectCornerAllCorners radius:10.0]; 33 | [viewTopLeftRight setRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight radius:10.0]; 34 | } 35 | 36 | - (void)viewDidUnload 37 | { 38 | [super viewDidUnload]; 39 | // Release any retained subviews of the main view. 40 | // e.g. self.myOutlet = nil; 41 | } 42 | 43 | - (void)viewWillAppear:(BOOL)animated 44 | { 45 | [super viewWillAppear:animated]; 46 | } 47 | 48 | - (void)viewDidAppear:(BOOL)animated 49 | { 50 | [super viewDidAppear:animated]; 51 | } 52 | 53 | - (void)viewWillDisappear:(BOOL)animated 54 | { 55 | [super viewWillDisappear:animated]; 56 | } 57 | 58 | - (void)viewDidDisappear:(BOOL)animated 59 | { 60 | [super viewDidDisappear:animated]; 61 | } 62 | 63 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 64 | { 65 | // Return YES for supported orientations 66 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/en.lproj/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 11C74 6 | 1938 7 | 1138.23 8 | 567.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 933 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | IBUILabel 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 274 41 | {{20, 15}, {50, 50}} 42 | 43 | 44 | 45 | _NS:196 46 | 47 | 3 48 | MQA 49 | 50 | 2 51 | 52 | 53 | IBCocoaTouchFramework 54 | 55 | 56 | 57 | 274 58 | {{20, 78}, {50, 50}} 59 | 60 | 61 | 62 | _NS:196 63 | 64 | 3 65 | MQA 66 | 67 | 68 | IBCocoaTouchFramework 69 | 70 | 71 | 72 | 274 73 | {{20, 141}, {50, 50}} 74 | 75 | 76 | 77 | _NS:196 78 | 79 | 3 80 | MQA 81 | 82 | 83 | IBCocoaTouchFramework 84 | 85 | 86 | 87 | 274 88 | {{20, 205}, {50, 50}} 89 | 90 | 91 | 92 | _NS:196 93 | 94 | 3 95 | MQA 96 | 97 | 98 | IBCocoaTouchFramework 99 | 100 | 101 | 102 | 274 103 | {{20, 270}, {50, 50}} 104 | 105 | 106 | 107 | _NS:196 108 | 109 | 3 110 | MQA 111 | 112 | 113 | IBCocoaTouchFramework 114 | 115 | 116 | 117 | 274 118 | {{20, 334}, {50, 50}} 119 | 120 | 121 | 122 | _NS:196 123 | 124 | 3 125 | MQA 126 | 127 | 128 | IBCocoaTouchFramework 129 | 130 | 131 | 132 | 292 133 | {{93, 29}, {181, 21}} 134 | 135 | 136 | 137 | _NS:328 138 | NO 139 | YES 140 | 7 141 | NO 142 | IBCocoaTouchFramework 143 | No corners rounded 144 | 145 | 1 146 | MCAwIDAAA 147 | 148 | 149 | 1 150 | 10 151 | 152 | 1 153 | 17 154 | 155 | 156 | Helvetica 157 | 17 158 | 16 159 | 160 | 161 | 162 | 163 | 292 164 | {{93, 92}, {181, 21}} 165 | 166 | 167 | 168 | _NS:328 169 | NO 170 | YES 171 | 7 172 | NO 173 | IBCocoaTouchFramework 174 | UIRectCornerTopLeft 175 | 176 | 177 | 1 178 | 10 179 | 180 | 181 | 182 | 183 | 184 | 292 185 | {{93, 155}, {181, 21}} 186 | 187 | 188 | 189 | _NS:328 190 | NO 191 | YES 192 | 7 193 | NO 194 | IBCocoaTouchFramework 195 | UIRectCornerTopRight 196 | 197 | 198 | 1 199 | 10 200 | 201 | 202 | 203 | 204 | 205 | 292 206 | {{93, 219}, {190, 21}} 207 | 208 | 209 | 210 | _NS:328 211 | NO 212 | YES 213 | 7 214 | NO 215 | IBCocoaTouchFramework 216 | UIRectCornerBottomLeft 217 | 218 | 219 | 1 220 | 10 221 | 222 | 223 | 224 | 225 | 226 | 292 227 | {{93, 284}, {201, 21}} 228 | 229 | 230 | 231 | _NS:328 232 | NO 233 | YES 234 | 7 235 | NO 236 | IBCocoaTouchFramework 237 | UIRectCornerBottomRight 238 | 239 | 240 | 1 241 | 10 242 | 243 | 244 | 245 | 246 | 247 | 292 248 | {{93, 348}, {181, 21}} 249 | 250 | 251 | 252 | _NS:328 253 | NO 254 | YES 255 | 7 256 | NO 257 | IBCocoaTouchFramework 258 | UIRectCornerAll 259 | 260 | 261 | 1 262 | 10 263 | 264 | 265 | 266 | 267 | 268 | 292 269 | {{93, 411}, {212, 21}} 270 | 271 | 272 | 273 | _NS:328 274 | NO 275 | YES 276 | 7 277 | NO 278 | IBCocoaTouchFramework 279 | UIRectCornerTopLeft | UIRectCornerTopRight 280 | 281 | 282 | 1 283 | 10 284 | 285 | 286 | 287 | 288 | 289 | 274 290 | {{20, 397}, {50, 50}} 291 | 292 | 293 | 294 | _NS:196 295 | 296 | 3 297 | MQA 298 | 299 | 300 | IBCocoaTouchFramework 301 | 302 | 303 | {{0, 20}, {320, 460}} 304 | 305 | 306 | 307 | 308 | 3 309 | MC43NQA 310 | 311 | 312 | NO 313 | 314 | IBCocoaTouchFramework 315 | 316 | 317 | 318 | 319 | 320 | 321 | view 322 | 323 | 324 | 325 | 7 326 | 327 | 328 | 329 | viewNone 330 | 331 | 332 | 333 | 23 334 | 335 | 336 | 337 | viewTopLeft 338 | 339 | 340 | 341 | 24 342 | 343 | 344 | 345 | viewAll 346 | 347 | 348 | 349 | 25 350 | 351 | 352 | 353 | viewBottomLeft 354 | 355 | 356 | 357 | 26 358 | 359 | 360 | 361 | viewBottomRight 362 | 363 | 364 | 365 | 27 366 | 367 | 368 | 369 | viewTopRight 370 | 371 | 372 | 373 | 28 374 | 375 | 376 | 377 | viewTopLeftRight 378 | 379 | 380 | 381 | 29 382 | 383 | 384 | 385 | 386 | 387 | 0 388 | 389 | 390 | 391 | 392 | 393 | -1 394 | 395 | 396 | File's Owner 397 | 398 | 399 | -2 400 | 401 | 402 | 403 | 404 | 6 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 8 426 | 427 | 428 | 429 | 430 | 9 431 | 432 | 433 | 434 | 435 | 10 436 | 437 | 438 | 439 | 440 | 11 441 | 442 | 443 | 444 | 445 | 12 446 | 447 | 448 | 449 | 450 | 13 451 | 452 | 453 | 454 | 455 | 14 456 | 457 | 458 | 459 | 460 | 15 461 | 462 | 463 | 464 | 465 | 16 466 | 467 | 468 | 469 | 470 | 17 471 | 472 | 473 | 474 | 475 | 18 476 | 477 | 478 | 479 | 480 | 19 481 | 482 | 483 | 484 | 485 | 20 486 | 487 | 488 | 489 | 490 | 30 491 | 492 | 493 | 494 | 495 | 496 | 497 | ViewController 498 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 499 | UIResponder 500 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 501 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 502 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 503 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 504 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 505 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 506 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 507 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 508 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 509 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 510 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 511 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 512 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 513 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 514 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 515 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 516 | 517 | 518 | 519 | 520 | 521 | 30 522 | 523 | 524 | 525 | 526 | ViewController 527 | UIViewController 528 | 529 | UIView 530 | UIView 531 | UIView 532 | UIView 533 | UIView 534 | UIView 535 | UIView 536 | 537 | 538 | 539 | viewAll 540 | UIView 541 | 542 | 543 | viewBottomLeft 544 | UIView 545 | 546 | 547 | viewBottomRight 548 | UIView 549 | 550 | 551 | viewNone 552 | UIView 553 | 554 | 555 | viewTopLeft 556 | UIView 557 | 558 | 559 | viewTopLeftRight 560 | UIView 561 | 562 | 563 | viewTopRight 564 | UIView 565 | 566 | 567 | 568 | IBProjectSource 569 | ./Classes/ViewController.h 570 | 571 | 572 | 573 | 574 | 0 575 | IBCocoaTouchFramework 576 | YES 577 | 3 578 | 933 579 | 580 | 581 | -------------------------------------------------------------------------------- /UIViewRoundedCorners/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // UIViewRoundedCorners 4 | // 5 | // Created by Vashishtha Jogi on 11/20/11. 6 | // Copyright (c) 2011 Vashishtha Jogi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------