├── .gitignore ├── AvtarImageView.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── AvtarImageView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── AvtarImageView │ ├── AvtarImageView.h │ └── AvtarImageView.m ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE ├── README.md └── Screen Shot 2017-04-20 at 12.45.36 PM.png /.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 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /AvtarImageView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E7EBC2701EA882C7002B3F6A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E7EBC26F1EA882C7002B3F6A /* main.m */; }; 11 | E7EBC2731EA882C7002B3F6A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E7EBC2721EA882C7002B3F6A /* AppDelegate.m */; }; 12 | E7EBC2761EA882C7002B3F6A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E7EBC2751EA882C7002B3F6A /* ViewController.m */; }; 13 | E7EBC2791EA882C7002B3F6A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E7EBC2771EA882C7002B3F6A /* Main.storyboard */; }; 14 | E7EBC27B1EA882C7002B3F6A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E7EBC27A1EA882C7002B3F6A /* Assets.xcassets */; }; 15 | E7EBC27E1EA882C7002B3F6A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E7EBC27C1EA882C7002B3F6A /* LaunchScreen.storyboard */; }; 16 | E7EBC28B1EA89773002B3F6A /* AvtarImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = E7EBC28A1EA89773002B3F6A /* AvtarImageView.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | E7EBC26B1EA882C7002B3F6A /* AvtarImageView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AvtarImageView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | E7EBC26F1EA882C7002B3F6A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | E7EBC2711EA882C7002B3F6A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 23 | E7EBC2721EA882C7002B3F6A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 24 | E7EBC2741EA882C7002B3F6A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 25 | E7EBC2751EA882C7002B3F6A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 26 | E7EBC2781EA882C7002B3F6A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | E7EBC27A1EA882C7002B3F6A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | E7EBC27D1EA882C7002B3F6A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | E7EBC27F1EA882C7002B3F6A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | E7EBC2891EA89773002B3F6A /* AvtarImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvtarImageView.h; sourceTree = ""; }; 31 | E7EBC28A1EA89773002B3F6A /* AvtarImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AvtarImageView.m; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | E7EBC2681EA882C7002B3F6A /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | E7EBC2621EA882C7002B3F6A = { 46 | isa = PBXGroup; 47 | children = ( 48 | E7EBC26D1EA882C7002B3F6A /* AvtarImageView */, 49 | E7EBC26C1EA882C7002B3F6A /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | E7EBC26C1EA882C7002B3F6A /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | E7EBC26B1EA882C7002B3F6A /* AvtarImageView.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | E7EBC26D1EA882C7002B3F6A /* AvtarImageView */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | E7EBC2711EA882C7002B3F6A /* AppDelegate.h */, 65 | E7EBC2721EA882C7002B3F6A /* AppDelegate.m */, 66 | E7EBC2741EA882C7002B3F6A /* ViewController.h */, 67 | E7EBC2751EA882C7002B3F6A /* ViewController.m */, 68 | E7EBC2771EA882C7002B3F6A /* Main.storyboard */, 69 | E7EBC27A1EA882C7002B3F6A /* Assets.xcassets */, 70 | E7EBC27C1EA882C7002B3F6A /* LaunchScreen.storyboard */, 71 | E7EBC27F1EA882C7002B3F6A /* Info.plist */, 72 | E7EBC2881EA89773002B3F6A /* AvtarImageView */, 73 | E7EBC26E1EA882C7002B3F6A /* Supporting Files */, 74 | ); 75 | path = AvtarImageView; 76 | sourceTree = ""; 77 | }; 78 | E7EBC26E1EA882C7002B3F6A /* Supporting Files */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | E7EBC26F1EA882C7002B3F6A /* main.m */, 82 | ); 83 | name = "Supporting Files"; 84 | sourceTree = ""; 85 | }; 86 | E7EBC2881EA89773002B3F6A /* AvtarImageView */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | E7EBC2891EA89773002B3F6A /* AvtarImageView.h */, 90 | E7EBC28A1EA89773002B3F6A /* AvtarImageView.m */, 91 | ); 92 | path = AvtarImageView; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXNativeTarget section */ 98 | E7EBC26A1EA882C7002B3F6A /* AvtarImageView */ = { 99 | isa = PBXNativeTarget; 100 | buildConfigurationList = E7EBC2821EA882C7002B3F6A /* Build configuration list for PBXNativeTarget "AvtarImageView" */; 101 | buildPhases = ( 102 | E7EBC2671EA882C7002B3F6A /* Sources */, 103 | E7EBC2681EA882C7002B3F6A /* Frameworks */, 104 | E7EBC2691EA882C7002B3F6A /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = AvtarImageView; 111 | productName = AvtarImageView; 112 | productReference = E7EBC26B1EA882C7002B3F6A /* AvtarImageView.app */; 113 | productType = "com.apple.product-type.application"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | E7EBC2631EA882C7002B3F6A /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastUpgradeCheck = 0820; 122 | ORGANIZATIONNAME = Vishal; 123 | TargetAttributes = { 124 | E7EBC26A1EA882C7002B3F6A = { 125 | CreatedOnToolsVersion = 8.2.1; 126 | ProvisioningStyle = Manual; 127 | }; 128 | }; 129 | }; 130 | buildConfigurationList = E7EBC2661EA882C7002B3F6A /* Build configuration list for PBXProject "AvtarImageView" */; 131 | compatibilityVersion = "Xcode 3.2"; 132 | developmentRegion = English; 133 | hasScannedForEncodings = 0; 134 | knownRegions = ( 135 | en, 136 | Base, 137 | ); 138 | mainGroup = E7EBC2621EA882C7002B3F6A; 139 | productRefGroup = E7EBC26C1EA882C7002B3F6A /* Products */; 140 | projectDirPath = ""; 141 | projectRoot = ""; 142 | targets = ( 143 | E7EBC26A1EA882C7002B3F6A /* AvtarImageView */, 144 | ); 145 | }; 146 | /* End PBXProject section */ 147 | 148 | /* Begin PBXResourcesBuildPhase section */ 149 | E7EBC2691EA882C7002B3F6A /* Resources */ = { 150 | isa = PBXResourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | E7EBC27E1EA882C7002B3F6A /* LaunchScreen.storyboard in Resources */, 154 | E7EBC27B1EA882C7002B3F6A /* Assets.xcassets in Resources */, 155 | E7EBC2791EA882C7002B3F6A /* Main.storyboard in Resources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXResourcesBuildPhase section */ 160 | 161 | /* Begin PBXSourcesBuildPhase section */ 162 | E7EBC2671EA882C7002B3F6A /* Sources */ = { 163 | isa = PBXSourcesBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | E7EBC2761EA882C7002B3F6A /* ViewController.m in Sources */, 167 | E7EBC2731EA882C7002B3F6A /* AppDelegate.m in Sources */, 168 | E7EBC2701EA882C7002B3F6A /* main.m in Sources */, 169 | E7EBC28B1EA89773002B3F6A /* AvtarImageView.m in Sources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXSourcesBuildPhase section */ 174 | 175 | /* Begin PBXVariantGroup section */ 176 | E7EBC2771EA882C7002B3F6A /* Main.storyboard */ = { 177 | isa = PBXVariantGroup; 178 | children = ( 179 | E7EBC2781EA882C7002B3F6A /* Base */, 180 | ); 181 | name = Main.storyboard; 182 | sourceTree = ""; 183 | }; 184 | E7EBC27C1EA882C7002B3F6A /* LaunchScreen.storyboard */ = { 185 | isa = PBXVariantGroup; 186 | children = ( 187 | E7EBC27D1EA882C7002B3F6A /* Base */, 188 | ); 189 | name = LaunchScreen.storyboard; 190 | sourceTree = ""; 191 | }; 192 | /* End PBXVariantGroup section */ 193 | 194 | /* Begin XCBuildConfiguration section */ 195 | E7EBC2801EA882C7002B3F6A /* Debug */ = { 196 | isa = XCBuildConfiguration; 197 | buildSettings = { 198 | ALWAYS_SEARCH_USER_PATHS = NO; 199 | CLANG_ANALYZER_NONNULL = YES; 200 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 201 | CLANG_CXX_LIBRARY = "libc++"; 202 | CLANG_ENABLE_MODULES = YES; 203 | CLANG_ENABLE_OBJC_ARC = YES; 204 | CLANG_WARN_BOOL_CONVERSION = YES; 205 | CLANG_WARN_CONSTANT_CONVERSION = YES; 206 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 207 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 208 | CLANG_WARN_EMPTY_BODY = YES; 209 | CLANG_WARN_ENUM_CONVERSION = YES; 210 | CLANG_WARN_INFINITE_RECURSION = YES; 211 | CLANG_WARN_INT_CONVERSION = YES; 212 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 213 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 214 | CLANG_WARN_UNREACHABLE_CODE = YES; 215 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 216 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 217 | COPY_PHASE_STRIP = NO; 218 | DEBUG_INFORMATION_FORMAT = dwarf; 219 | ENABLE_STRICT_OBJC_MSGSEND = YES; 220 | ENABLE_TESTABILITY = YES; 221 | GCC_C_LANGUAGE_STANDARD = gnu99; 222 | GCC_DYNAMIC_NO_PIC = NO; 223 | GCC_NO_COMMON_BLOCKS = YES; 224 | GCC_OPTIMIZATION_LEVEL = 0; 225 | GCC_PREPROCESSOR_DEFINITIONS = ( 226 | "DEBUG=1", 227 | "$(inherited)", 228 | ); 229 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 230 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 231 | GCC_WARN_UNDECLARED_SELECTOR = YES; 232 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 233 | GCC_WARN_UNUSED_FUNCTION = YES; 234 | GCC_WARN_UNUSED_VARIABLE = YES; 235 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 236 | MTL_ENABLE_DEBUG_INFO = YES; 237 | ONLY_ACTIVE_ARCH = YES; 238 | SDKROOT = iphoneos; 239 | }; 240 | name = Debug; 241 | }; 242 | E7EBC2811EA882C7002B3F6A /* Release */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ALWAYS_SEARCH_USER_PATHS = NO; 246 | CLANG_ANALYZER_NONNULL = YES; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_WARN_BOOL_CONVERSION = YES; 252 | CLANG_WARN_CONSTANT_CONVERSION = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INFINITE_RECURSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 261 | CLANG_WARN_UNREACHABLE_CODE = YES; 262 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 263 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 264 | COPY_PHASE_STRIP = NO; 265 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 266 | ENABLE_NS_ASSERTIONS = NO; 267 | ENABLE_STRICT_OBJC_MSGSEND = YES; 268 | GCC_C_LANGUAGE_STANDARD = gnu99; 269 | GCC_NO_COMMON_BLOCKS = YES; 270 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 271 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 272 | GCC_WARN_UNDECLARED_SELECTOR = YES; 273 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 274 | GCC_WARN_UNUSED_FUNCTION = YES; 275 | GCC_WARN_UNUSED_VARIABLE = YES; 276 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 277 | MTL_ENABLE_DEBUG_INFO = NO; 278 | SDKROOT = iphoneos; 279 | VALIDATE_PRODUCT = YES; 280 | }; 281 | name = Release; 282 | }; 283 | E7EBC2831EA882C7002B3F6A /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | DEVELOPMENT_TEAM = ""; 288 | INFOPLIST_FILE = AvtarImageView/Info.plist; 289 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 290 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 291 | PRODUCT_BUNDLE_IDENTIFIER = com.apps.AvtarImageView; 292 | PRODUCT_NAME = "$(TARGET_NAME)"; 293 | }; 294 | name = Debug; 295 | }; 296 | E7EBC2841EA882C7002B3F6A /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 300 | DEVELOPMENT_TEAM = ""; 301 | INFOPLIST_FILE = AvtarImageView/Info.plist; 302 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 303 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 304 | PRODUCT_BUNDLE_IDENTIFIER = com.apps.AvtarImageView; 305 | PRODUCT_NAME = "$(TARGET_NAME)"; 306 | }; 307 | name = Release; 308 | }; 309 | /* End XCBuildConfiguration section */ 310 | 311 | /* Begin XCConfigurationList section */ 312 | E7EBC2661EA882C7002B3F6A /* Build configuration list for PBXProject "AvtarImageView" */ = { 313 | isa = XCConfigurationList; 314 | buildConfigurations = ( 315 | E7EBC2801EA882C7002B3F6A /* Debug */, 316 | E7EBC2811EA882C7002B3F6A /* Release */, 317 | ); 318 | defaultConfigurationIsVisible = 0; 319 | defaultConfigurationName = Release; 320 | }; 321 | E7EBC2821EA882C7002B3F6A /* Build configuration list for PBXNativeTarget "AvtarImageView" */ = { 322 | isa = XCConfigurationList; 323 | buildConfigurations = ( 324 | E7EBC2831EA882C7002B3F6A /* Debug */, 325 | E7EBC2841EA882C7002B3F6A /* Release */, 326 | ); 327 | defaultConfigurationIsVisible = 0; 328 | defaultConfigurationName = Release; 329 | }; 330 | /* End XCConfigurationList section */ 331 | }; 332 | rootObject = E7EBC2631EA882C7002B3F6A /* Project object */; 333 | } 334 | -------------------------------------------------------------------------------- /AvtarImageView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AvtarImageView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AvtarImageView 4 | // 5 | // Created by Mac-Vishal on 20/04/17. 6 | // Copyright © 2017 Vishal. 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 | -------------------------------------------------------------------------------- /AvtarImageView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AvtarImageView 4 | // 5 | // Created by Mac-Vishal on 20/04/17. 6 | // Copyright © 2017 Vishal. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // 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. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /AvtarImageView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /AvtarImageView/AvtarImageView/AvtarImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // AvtarImageView.h 3 | // AvtarImageView 4 | // 5 | // Created by Mac-Vishal on 20/04/17. 6 | // Copyright © 2017 Vishal. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | IB_DESIGNABLE 12 | @interface AvtarImageView : UIImageView 13 | 14 | @property (nonatomic) IBInspectable NSInteger borderWidth; 15 | @property (nonatomic) IBInspectable UIColor *borderColor; 16 | @property (nonatomic) IBInspectable CGFloat cornerRadious; 17 | @property (nonatomic) IBInspectable BOOL isCircular; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /AvtarImageView/AvtarImageView/AvtarImageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // AvtarImageView.m 3 | // AvtarImageView 4 | // 5 | // Created by Mac-Vishal on 20/04/17. 6 | // Copyright © 2017 Vishal. All rights reserved. 7 | // 8 | 9 | #import "AvtarImageView.h" 10 | 11 | @implementation AvtarImageView 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | 17 | self.borderWidth = 2; 18 | self.cornerRadious = 10; 19 | self.borderColor = [UIColor blackColor]; 20 | 21 | [self customInit]; 22 | } 23 | return self; 24 | } 25 | - (id)initWithCoder:(NSCoder *)aDecoder { 26 | self = [super initWithCoder:aDecoder]; 27 | if (self) { 28 | [self customInit]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)drawRect:(CGRect)rect { 34 | [self customInit]; 35 | } 36 | 37 | - (void)setNeedsLayout { 38 | [super setNeedsLayout]; 39 | [self setNeedsDisplay]; 40 | } 41 | 42 | 43 | - (void)prepareForInterfaceBuilder { 44 | 45 | [self customInit]; 46 | } 47 | 48 | - (void)customInit { 49 | 50 | self.layer.cornerRadius = self.cornerRadious; 51 | self.layer.borderWidth = self.borderWidth; 52 | self.layer.borderColor =self.borderColor.CGColor; 53 | self.layer.masksToBounds = YES; 54 | _isCircular = self.isCircular; 55 | 56 | if (_isCircular) { 57 | 58 | self.layer.cornerRadius = self.frame.size.width/2; 59 | } 60 | } 61 | @end 62 | -------------------------------------------------------------------------------- /AvtarImageView/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 | 27 | 28 | -------------------------------------------------------------------------------- /AvtarImageView/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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /AvtarImageView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 38 | 39 | -------------------------------------------------------------------------------- /AvtarImageView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AvtarImageView 4 | // 5 | // Created by Mac-Vishal on 20/04/17. 6 | // Copyright © 2017 Vishal. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AvtarImageView.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @property (nonatomic, strong) IBOutlet AvtarImageView *imgAvtar; 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /AvtarImageView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AvtarImageView 4 | // 5 | // Created by Mac-Vishal on 20/04/17. 6 | // Copyright © 2017 Vishal. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | 24 | - (void)didReceiveMemoryWarning { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /AvtarImageView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AvtarImageView 4 | // 5 | // Created by Mac-Vishal on 20/04/17. 6 | // Copyright © 2017 Vishal. 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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 VishalNandoriya 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 | # AvtarImageView 2 | Live rendering and expose the control’s properties in Interface Builder 3 | 4 | In this tutorial we’ll look at how to create a custom ImageView, enable live rendering and expose the control’s properties in Interface Builder. 5 | 6 | The @IBDesignable designation lets Interface Builder know that it should render the view directly in the canvas. 7 | 8 | This allows seeing how your custom views will appear without building and running your app after each change. 9 | 10 | ![N|Solid](https://github.com/VishalNandoriya/AvtarImageView/blob/master/Screen%20Shot%202017-04-20%20at%2012.45.36%20PM.png) 11 | -------------------------------------------------------------------------------- /Screen Shot 2017-04-20 at 12.45.36 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VishalNandoriya/AvatarImageView/1ddb63123898badf920fae7a6c4cdaee231b834d/Screen Shot 2017-04-20 at 12.45.36 PM.png --------------------------------------------------------------------------------