├── Example ├── Tutorial Category Demo.xcodeproj │ └── project.pbxproj ├── Tutorial Category │ ├── DKAppDelegate.h │ ├── DKAppDelegate.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Tutorial Category Demo-Info.plist │ ├── Tutorial Category Demo-Prefix.pch │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m └── Tutorial CategoryTests │ ├── Tutorial Category DemoTests-Info.plist │ ├── Tutorial_CategoryTests.m │ └── en.lproj │ └── InfoPlist.strings ├── LICENSE.txt ├── README.md ├── UIlViewController+Tutorial ├── DKCircleImageView.h ├── DKCircleImageView.m ├── UIViewController+Tutorial.h └── UIViewController+Tutorial.m └── example.gif /Example/Tutorial Category Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 02768A491916153C00653300 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02768A481916153C00653300 /* Foundation.framework */; }; 11 | 02768A4B1916153C00653300 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02768A4A1916153C00653300 /* CoreGraphics.framework */; }; 12 | 02768A4D1916153C00653300 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02768A4C1916153C00653300 /* UIKit.framework */; }; 13 | 02768A531916153C00653300 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 02768A511916153C00653300 /* InfoPlist.strings */; }; 14 | 02768A551916153C00653300 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 02768A541916153C00653300 /* main.m */; }; 15 | 02768A591916153C00653300 /* DKAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 02768A581916153C00653300 /* DKAppDelegate.m */; }; 16 | 02768A5B1916153C00653300 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 02768A5A1916153C00653300 /* Images.xcassets */; }; 17 | 02768A621916153C00653300 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02768A611916153C00653300 /* XCTest.framework */; }; 18 | 02768A631916153C00653300 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02768A481916153C00653300 /* Foundation.framework */; }; 19 | 02768A641916153C00653300 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02768A4C1916153C00653300 /* UIKit.framework */; }; 20 | 02768A6C1916153C00653300 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 02768A6A1916153C00653300 /* InfoPlist.strings */; }; 21 | 02768A6E1916153C00653300 /* Tutorial_CategoryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 02768A6D1916153C00653300 /* Tutorial_CategoryTests.m */; }; 22 | F49A2CB6198B028900E40961 /* DKCircleImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = F49A2CB3198B028900E40961 /* DKCircleImageView.m */; }; 23 | F49A2CB7198B028900E40961 /* UIViewController+Tutorial.m in Sources */ = {isa = PBXBuildFile; fileRef = F49A2CB5198B028900E40961 /* UIViewController+Tutorial.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 02768A651916153C00653300 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 02768A3D1916153C00653300 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 02768A441916153C00653300; 32 | remoteInfo = "Tutorial Category"; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 02768A451916153C00653300 /* Tutorial Category Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Tutorial Category Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 02768A481916153C00653300 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 39 | 02768A4A1916153C00653300 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 40 | 02768A4C1916153C00653300 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 41 | 02768A501916153C00653300 /* Tutorial Category Demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tutorial Category Demo-Info.plist"; sourceTree = ""; }; 42 | 02768A521916153C00653300 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 43 | 02768A541916153C00653300 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 44 | 02768A561916153C00653300 /* Tutorial Category Demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tutorial Category Demo-Prefix.pch"; sourceTree = ""; }; 45 | 02768A571916153C00653300 /* DKAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DKAppDelegate.h; sourceTree = ""; }; 46 | 02768A581916153C00653300 /* DKAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DKAppDelegate.m; sourceTree = ""; }; 47 | 02768A5A1916153C00653300 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 48 | 02768A601916153C00653300 /* Tutorial Category DemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tutorial Category DemoTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 02768A611916153C00653300 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 50 | 02768A691916153C00653300 /* Tutorial Category DemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tutorial Category DemoTests-Info.plist"; sourceTree = ""; }; 51 | 02768A6B1916153C00653300 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 52 | 02768A6D1916153C00653300 /* Tutorial_CategoryTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tutorial_CategoryTests.m; sourceTree = ""; }; 53 | F49A2CB2198B028900E40961 /* DKCircleImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKCircleImageView.h; sourceTree = ""; }; 54 | F49A2CB3198B028900E40961 /* DKCircleImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DKCircleImageView.m; sourceTree = ""; }; 55 | F49A2CB4198B028900E40961 /* UIViewController+Tutorial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Tutorial.h"; sourceTree = ""; }; 56 | F49A2CB5198B028900E40961 /* UIViewController+Tutorial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Tutorial.m"; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 02768A421916153C00653300 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | 02768A4B1916153C00653300 /* CoreGraphics.framework in Frameworks */, 65 | 02768A4D1916153C00653300 /* UIKit.framework in Frameworks */, 66 | 02768A491916153C00653300 /* Foundation.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | 02768A5D1916153C00653300 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | 02768A621916153C00653300 /* XCTest.framework in Frameworks */, 75 | 02768A641916153C00653300 /* UIKit.framework in Frameworks */, 76 | 02768A631916153C00653300 /* Foundation.framework in Frameworks */, 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 02768A3C1916153C00653300 = { 84 | isa = PBXGroup; 85 | children = ( 86 | 02768A4E1916153C00653300 /* Tutorial Category */, 87 | 02768A671916153C00653300 /* Tutorial CategoryTests */, 88 | 02768A471916153C00653300 /* Frameworks */, 89 | 02768A461916153C00653300 /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 02768A461916153C00653300 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 02768A451916153C00653300 /* Tutorial Category Demo.app */, 97 | 02768A601916153C00653300 /* Tutorial Category DemoTests.xctest */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 02768A471916153C00653300 /* Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 02768A481916153C00653300 /* Foundation.framework */, 106 | 02768A4A1916153C00653300 /* CoreGraphics.framework */, 107 | 02768A4C1916153C00653300 /* UIKit.framework */, 108 | 02768A611916153C00653300 /* XCTest.framework */, 109 | ); 110 | name = Frameworks; 111 | sourceTree = ""; 112 | }; 113 | 02768A4E1916153C00653300 /* Tutorial Category */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | F49A2CB1198B028900E40961 /* UIlViewController+Tutorial */, 117 | 02768A571916153C00653300 /* DKAppDelegate.h */, 118 | 02768A581916153C00653300 /* DKAppDelegate.m */, 119 | 02768A5A1916153C00653300 /* Images.xcassets */, 120 | 02768A4F1916153C00653300 /* Supporting Files */, 121 | ); 122 | path = "Tutorial Category"; 123 | sourceTree = ""; 124 | }; 125 | 02768A4F1916153C00653300 /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 02768A501916153C00653300 /* Tutorial Category Demo-Info.plist */, 129 | 02768A511916153C00653300 /* InfoPlist.strings */, 130 | 02768A541916153C00653300 /* main.m */, 131 | 02768A561916153C00653300 /* Tutorial Category Demo-Prefix.pch */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | 02768A671916153C00653300 /* Tutorial CategoryTests */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 02768A6D1916153C00653300 /* Tutorial_CategoryTests.m */, 140 | 02768A681916153C00653300 /* Supporting Files */, 141 | ); 142 | path = "Tutorial CategoryTests"; 143 | sourceTree = ""; 144 | }; 145 | 02768A681916153C00653300 /* Supporting Files */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 02768A691916153C00653300 /* Tutorial Category DemoTests-Info.plist */, 149 | 02768A6A1916153C00653300 /* InfoPlist.strings */, 150 | ); 151 | name = "Supporting Files"; 152 | sourceTree = ""; 153 | }; 154 | F49A2CB1198B028900E40961 /* UIlViewController+Tutorial */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | F49A2CB2198B028900E40961 /* DKCircleImageView.h */, 158 | F49A2CB3198B028900E40961 /* DKCircleImageView.m */, 159 | F49A2CB4198B028900E40961 /* UIViewController+Tutorial.h */, 160 | F49A2CB5198B028900E40961 /* UIViewController+Tutorial.m */, 161 | ); 162 | name = "UIlViewController+Tutorial"; 163 | path = "../../UIlViewController+Tutorial"; 164 | sourceTree = ""; 165 | }; 166 | /* End PBXGroup section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 02768A441916153C00653300 /* Tutorial Category Demo */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 02768A711916153C00653300 /* Build configuration list for PBXNativeTarget "Tutorial Category Demo" */; 172 | buildPhases = ( 173 | 02768A411916153C00653300 /* Sources */, 174 | 02768A421916153C00653300 /* Frameworks */, 175 | 02768A431916153C00653300 /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | ); 181 | name = "Tutorial Category Demo"; 182 | productName = "Tutorial Category"; 183 | productReference = 02768A451916153C00653300 /* Tutorial Category Demo.app */; 184 | productType = "com.apple.product-type.application"; 185 | }; 186 | 02768A5F1916153C00653300 /* Tutorial Category DemoTests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = 02768A741916153C00653300 /* Build configuration list for PBXNativeTarget "Tutorial Category DemoTests" */; 189 | buildPhases = ( 190 | 02768A5C1916153C00653300 /* Sources */, 191 | 02768A5D1916153C00653300 /* Frameworks */, 192 | 02768A5E1916153C00653300 /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | 02768A661916153C00653300 /* PBXTargetDependency */, 198 | ); 199 | name = "Tutorial Category DemoTests"; 200 | productName = "Tutorial CategoryTests"; 201 | productReference = 02768A601916153C00653300 /* Tutorial Category DemoTests.xctest */; 202 | productType = "com.apple.product-type.bundle.unit-test"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | 02768A3D1916153C00653300 /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | CLASSPREFIX = DK; 211 | LastUpgradeCheck = 0510; 212 | ORGANIZATIONNAME = "Dmitry Klimkin"; 213 | TargetAttributes = { 214 | 02768A5F1916153C00653300 = { 215 | TestTargetID = 02768A441916153C00653300; 216 | }; 217 | }; 218 | }; 219 | buildConfigurationList = 02768A401916153C00653300 /* Build configuration list for PBXProject "Tutorial Category Demo" */; 220 | compatibilityVersion = "Xcode 3.2"; 221 | developmentRegion = English; 222 | hasScannedForEncodings = 0; 223 | knownRegions = ( 224 | en, 225 | ); 226 | mainGroup = 02768A3C1916153C00653300; 227 | productRefGroup = 02768A461916153C00653300 /* Products */; 228 | projectDirPath = ""; 229 | projectRoot = ""; 230 | targets = ( 231 | 02768A441916153C00653300 /* Tutorial Category Demo */, 232 | 02768A5F1916153C00653300 /* Tutorial Category DemoTests */, 233 | ); 234 | }; 235 | /* End PBXProject section */ 236 | 237 | /* Begin PBXResourcesBuildPhase section */ 238 | 02768A431916153C00653300 /* Resources */ = { 239 | isa = PBXResourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | 02768A531916153C00653300 /* InfoPlist.strings in Resources */, 243 | 02768A5B1916153C00653300 /* Images.xcassets in Resources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | 02768A5E1916153C00653300 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | 02768A6C1916153C00653300 /* InfoPlist.strings in Resources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXResourcesBuildPhase section */ 256 | 257 | /* Begin PBXSourcesBuildPhase section */ 258 | 02768A411916153C00653300 /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 02768A551916153C00653300 /* main.m in Sources */, 263 | F49A2CB6198B028900E40961 /* DKCircleImageView.m in Sources */, 264 | F49A2CB7198B028900E40961 /* UIViewController+Tutorial.m in Sources */, 265 | 02768A591916153C00653300 /* DKAppDelegate.m in Sources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | 02768A5C1916153C00653300 /* Sources */ = { 270 | isa = PBXSourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | 02768A6E1916153C00653300 /* Tutorial_CategoryTests.m in Sources */, 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | }; 277 | /* End PBXSourcesBuildPhase section */ 278 | 279 | /* Begin PBXTargetDependency section */ 280 | 02768A661916153C00653300 /* PBXTargetDependency */ = { 281 | isa = PBXTargetDependency; 282 | target = 02768A441916153C00653300 /* Tutorial Category Demo */; 283 | targetProxy = 02768A651916153C00653300 /* PBXContainerItemProxy */; 284 | }; 285 | /* End PBXTargetDependency section */ 286 | 287 | /* Begin PBXVariantGroup section */ 288 | 02768A511916153C00653300 /* InfoPlist.strings */ = { 289 | isa = PBXVariantGroup; 290 | children = ( 291 | 02768A521916153C00653300 /* en */, 292 | ); 293 | name = InfoPlist.strings; 294 | sourceTree = ""; 295 | }; 296 | 02768A6A1916153C00653300 /* InfoPlist.strings */ = { 297 | isa = PBXVariantGroup; 298 | children = ( 299 | 02768A6B1916153C00653300 /* en */, 300 | ); 301 | name = InfoPlist.strings; 302 | sourceTree = ""; 303 | }; 304 | /* End PBXVariantGroup section */ 305 | 306 | /* Begin XCBuildConfiguration section */ 307 | 02768A6F1916153C00653300 /* Debug */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 312 | CLANG_CXX_LIBRARY = "libc++"; 313 | CLANG_ENABLE_MODULES = YES; 314 | CLANG_ENABLE_OBJC_ARC = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_CONSTANT_CONVERSION = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_EMPTY_BODY = YES; 319 | CLANG_WARN_ENUM_CONVERSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 323 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 324 | COPY_PHASE_STRIP = NO; 325 | GCC_C_LANGUAGE_STANDARD = gnu99; 326 | GCC_DYNAMIC_NO_PIC = NO; 327 | GCC_OPTIMIZATION_LEVEL = 0; 328 | GCC_PREPROCESSOR_DEFINITIONS = ( 329 | "DEBUG=1", 330 | "$(inherited)", 331 | ); 332 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 333 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 334 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 335 | GCC_WARN_UNDECLARED_SELECTOR = YES; 336 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 337 | GCC_WARN_UNUSED_FUNCTION = YES; 338 | GCC_WARN_UNUSED_VARIABLE = YES; 339 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 340 | ONLY_ACTIVE_ARCH = YES; 341 | SDKROOT = iphoneos; 342 | }; 343 | name = Debug; 344 | }; 345 | 02768A701916153C00653300 /* Release */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ALWAYS_SEARCH_USER_PATHS = NO; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 356 | CLANG_WARN_EMPTY_BODY = YES; 357 | CLANG_WARN_ENUM_CONVERSION = YES; 358 | CLANG_WARN_INT_CONVERSION = YES; 359 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = YES; 363 | ENABLE_NS_ASSERTIONS = NO; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 366 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 367 | GCC_WARN_UNDECLARED_SELECTOR = YES; 368 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 369 | GCC_WARN_UNUSED_FUNCTION = YES; 370 | GCC_WARN_UNUSED_VARIABLE = YES; 371 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 372 | SDKROOT = iphoneos; 373 | VALIDATE_PRODUCT = YES; 374 | }; 375 | name = Release; 376 | }; 377 | 02768A721916153C00653300 /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 381 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 382 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 383 | GCC_PREFIX_HEADER = "Tutorial Category/Tutorial Category Demo-Prefix.pch"; 384 | INFOPLIST_FILE = "Tutorial Category/Tutorial Category Demo-Info.plist"; 385 | PRODUCT_NAME = "Tutorial Category Demo"; 386 | WRAPPER_EXTENSION = app; 387 | }; 388 | name = Debug; 389 | }; 390 | 02768A731916153C00653300 /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 394 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 395 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 396 | GCC_PREFIX_HEADER = "Tutorial Category/Tutorial Category Demo-Prefix.pch"; 397 | INFOPLIST_FILE = "Tutorial Category/Tutorial Category Demo-Info.plist"; 398 | PRODUCT_NAME = "Tutorial Category Demo"; 399 | WRAPPER_EXTENSION = app; 400 | }; 401 | name = Release; 402 | }; 403 | 02768A751916153C00653300 /* Debug */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Tutorial Category.app/Tutorial Category"; 407 | FRAMEWORK_SEARCH_PATHS = ( 408 | "$(SDKROOT)/Developer/Library/Frameworks", 409 | "$(inherited)", 410 | "$(DEVELOPER_FRAMEWORKS_DIR)", 411 | ); 412 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 413 | GCC_PREFIX_HEADER = "Tutorial Category/Tutorial Category-Prefix.pch"; 414 | GCC_PREPROCESSOR_DEFINITIONS = ( 415 | "DEBUG=1", 416 | "$(inherited)", 417 | ); 418 | INFOPLIST_FILE = "Tutorial CategoryTests/Tutorial Category DemoTests-Info.plist"; 419 | PRODUCT_NAME = "Tutorial Category DemoTests"; 420 | TEST_HOST = "$(BUNDLE_LOADER)"; 421 | WRAPPER_EXTENSION = xctest; 422 | }; 423 | name = Debug; 424 | }; 425 | 02768A761916153C00653300 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Tutorial Category.app/Tutorial Category"; 429 | FRAMEWORK_SEARCH_PATHS = ( 430 | "$(SDKROOT)/Developer/Library/Frameworks", 431 | "$(inherited)", 432 | "$(DEVELOPER_FRAMEWORKS_DIR)", 433 | ); 434 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 435 | GCC_PREFIX_HEADER = "Tutorial Category/Tutorial Category-Prefix.pch"; 436 | INFOPLIST_FILE = "Tutorial CategoryTests/Tutorial Category DemoTests-Info.plist"; 437 | PRODUCT_NAME = "Tutorial Category DemoTests"; 438 | TEST_HOST = "$(BUNDLE_LOADER)"; 439 | WRAPPER_EXTENSION = xctest; 440 | }; 441 | name = Release; 442 | }; 443 | /* End XCBuildConfiguration section */ 444 | 445 | /* Begin XCConfigurationList section */ 446 | 02768A401916153C00653300 /* Build configuration list for PBXProject "Tutorial Category Demo" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | 02768A6F1916153C00653300 /* Debug */, 450 | 02768A701916153C00653300 /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | defaultConfigurationName = Release; 454 | }; 455 | 02768A711916153C00653300 /* Build configuration list for PBXNativeTarget "Tutorial Category Demo" */ = { 456 | isa = XCConfigurationList; 457 | buildConfigurations = ( 458 | 02768A721916153C00653300 /* Debug */, 459 | 02768A731916153C00653300 /* Release */, 460 | ); 461 | defaultConfigurationIsVisible = 0; 462 | defaultConfigurationName = Release; 463 | }; 464 | 02768A741916153C00653300 /* Build configuration list for PBXNativeTarget "Tutorial Category DemoTests" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | 02768A751916153C00653300 /* Debug */, 468 | 02768A761916153C00653300 /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | defaultConfigurationName = Release; 472 | }; 473 | /* End XCConfigurationList section */ 474 | }; 475 | rootObject = 02768A3D1916153C00653300 /* Project object */; 476 | } 477 | -------------------------------------------------------------------------------- /Example/Tutorial Category/DKAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DKAppDelegate.h 3 | // Tutorial Category 4 | // 5 | // Created by Dmitry Klimkin on 4/5/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DKAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/Tutorial Category/DKAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // DKAppDelegate.m 3 | // Tutorial Category 4 | // 5 | // Created by Dmitry Klimkin on 4/5/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | #import "DKAppDelegate.h" 10 | #import "UIViewController+Tutorial.h" 11 | 12 | @implementation DKAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | // Override point for customization after application launch. 18 | self.window.backgroundColor = [UIColor whiteColor]; 19 | 20 | UIViewController *viewController = [UIViewController new]; 21 | 22 | viewController.view.backgroundColor = [UIColor colorWithRed:0.29 green:0.59 blue:0.81 alpha:1]; 23 | 24 | self.window.backgroundColor = viewController.view.backgroundColor; 25 | self.window.rootViewController = viewController; 26 | 27 | [viewController startNavigationTutorial]; 28 | 29 | int64_t delayInSeconds = 5; 30 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 31 | 32 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { 33 | [viewController startCreateNewItemTutorialWithInfo:NSLocalizedString(@"Pull down to create new item", nil)]; 34 | }); 35 | 36 | delayInSeconds = 10; 37 | popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 38 | 39 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { 40 | [viewController startTapTutorialWithInfo:NSLocalizedString(@"Tap here to open settings", nil) 41 | atPoint:CGPointMake(160, 350) 42 | withFingerprintPoint:CGPointMake(160, 200) 43 | shouldHideBackground:NO 44 | completion:^{ 45 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Tutorial finished" message:@"This is the completion block!" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil]; 46 | [alert show]; 47 | }]; 48 | }); 49 | 50 | [self.window makeKeyAndVisible]; 51 | return YES; 52 | } 53 | 54 | - (void)applicationWillResignActive:(UIApplication *)application 55 | { 56 | // 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. 57 | // 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. 58 | } 59 | 60 | - (void)applicationDidEnterBackground:(UIApplication *)application 61 | { 62 | // 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. 63 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 64 | } 65 | 66 | - (void)applicationWillEnterForeground:(UIApplication *)application 67 | { 68 | // 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. 69 | } 70 | 71 | - (void)applicationDidBecomeActive:(UIApplication *)application 72 | { 73 | // 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. 74 | } 75 | 76 | - (void)applicationWillTerminate:(UIApplication *)application 77 | { 78 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Example/Tutorial Category/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Example/Tutorial Category/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Example/Tutorial Category/Tutorial Category Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.dklimkin.tutorial.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Example/Tutorial Category/Tutorial Category Demo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/Tutorial Category/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/Tutorial Category/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Tutorial Category 4 | // 5 | // Created by Dmitry Klimkin on 4/5/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DKAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([DKAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Tutorial CategoryTests/Tutorial Category DemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.dklimkin.tutorial.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tutorial CategoryTests/Tutorial_CategoryTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Tutorial_CategoryTests.m 3 | // Tutorial CategoryTests 4 | // 5 | // Created by Dmitry Klimkin on 4/5/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Tutorial_CategoryTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tutorial_CategoryTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Example/Tutorial CategoryTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 by Dmitry Klimkin 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | UIViewController+Tutorial 2 | ================== 3 | 4 | Sources of UIViewController+Tutorial and Demo app to show fancy on-boarding tutorials. 5 | 6 | ##Download 7 | $ git clone https://github.com/kronik/UIViewController-Tutorial.git 8 | $ cd UIViewController-Tutorial/ 9 | 10 | ##Usage 11 | Please check out the demo project included. 12 | # ![Screenshot](https://raw.github.com/kronik/UIViewController-Tutorial/master/example.gif) 13 | 14 | ### Initialization 15 | ``` objective-c 16 | #import "UIViewController+Tutorial.h" 17 | ``` 18 | 19 | ### Trigger navigation tutorial 20 | ``` objective-c 21 | - (void)viewDidAppear: (BOOL)animated{ 22 | [super viewDidAppear:animated]; 23 | 24 | [self startNavigationTutorial]; 25 | } 26 | ``` 27 | 28 | ### Trigger create new item tutorial 29 | ``` objective-c 30 | - (void)viewDidAppear: (BOOL)animated{ 31 | [super viewDidAppear:animated]; 32 | 33 | [self startCreateNewItemTutorialWithInfo:NSLocalizedString(@"Pull down to create new item", nil)]; 34 | } 35 | ``` 36 | 37 | ### Trigger tap to open settings tutorial 38 | ``` objective-c 39 | - (void)viewDidAppear: (BOOL)animated{ 40 | [super viewDidAppear:animated]; 41 | 42 | [self startTapTutorialWithInfo:NSLocalizedString(@"Tap here to open settings", nil) 43 | atPoint:CGPointMake(160, 350) 44 | withFingerprintPoint:CGPointMake(160, 200) 45 | shouldHideBackground:NO]; 46 | } 47 | ``` 48 | 49 | ##Requirements 50 | Supported build target - iOS 7.x 51 | Earliest supported deployment target - iOS 7.0 52 | 53 | ##License 54 | UIViewController+Tutorial is available under the MIT license. See the LICENSE file for more info. 55 | -------------------------------------------------------------------------------- /UIlViewController+Tutorial/DKCircleImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DKCircleImageView.h 3 | // DKCircleImageView 4 | // 5 | // Created by Dmitry Klimkin on 28/2/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DKCircleImageView : UIImageView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /UIlViewController+Tutorial/DKCircleImageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DKCircleImageView.m 3 | // DKCircleImageView 4 | // 5 | // Created by Dmitry Klimkin on 28/2/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | #import "DKCircleImageView.h" 10 | 11 | #define DKCircleImageViewBorderWidth 3.0f 12 | 13 | @implementation DKCircleImageView 14 | 15 | - (void)layoutSubviews { 16 | [super layoutSubviews]; 17 | [self updateMaskToBounds:self.bounds]; 18 | } 19 | 20 | - (void)updateMaskToBounds:(CGRect)maskBounds { 21 | CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; 22 | 23 | CGPathRef maskPath = CGPathCreateWithEllipseInRect(maskBounds, NULL); 24 | 25 | maskLayer.bounds = maskBounds; 26 | maskLayer.path = maskPath; 27 | maskLayer.fillColor = [UIColor blackColor].CGColor; 28 | 29 | CGPoint point = CGPointMake(maskBounds.size.width/2, maskBounds.size.height/2); 30 | maskLayer.position = point; 31 | 32 | self.layer.cornerRadius = CGRectGetHeight(maskBounds) / 2.0; 33 | self.layer.borderColor = [[UIColor whiteColor] colorWithAlphaComponent:0.7].CGColor; 34 | self.layer.borderWidth = DKCircleImageViewBorderWidth; 35 | 36 | [self.layer setMask:maskLayer]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /UIlViewController+Tutorial/UIViewController+Tutorial.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Tutorial.h 3 | // UIViewController+Tutorial 4 | // 5 | // Created by Dmitry Klimkin on 27/2/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | typedef void(^UIViewControllerTutorialCompletionBlock)(); 12 | 13 | @interface UIViewController (Tutorial) 14 | 15 | - (void)animateTapForView: (UIView *)view; 16 | 17 | - (void)startNavigationTutorial; 18 | - (void)startShowItemOptionsTutorial; 19 | - (void)startCreateNewItemTutorialWithInfo: (NSString *)infoText; 20 | 21 | - (void)startTutorialWithInfo: (NSString *)infoText 22 | atPoint: (CGPoint)infoPoint 23 | withFingerprintStartingPoint: (CGPoint)startPoint 24 | andEndPoint: (CGPoint)endPoint 25 | shouldHideBackground: (BOOL)hideBackground; 26 | 27 | - (void)startTutorialWithInfo: (NSString *)infoText 28 | atPoint: (CGPoint)infoPoint 29 | withFingerprintStartingPoint: (CGPoint)startPoint 30 | andEndPoint: (CGPoint)endPoint 31 | shouldHideBackground: (BOOL)hideBackground 32 | completion: (UIViewControllerTutorialCompletionBlock)completion; 33 | 34 | - (void)startTapTutorialWithInfo: (NSString *)infoText 35 | atPoint: (CGPoint)infoPoint 36 | withFingerprintPoint: (CGPoint)touchPoint 37 | shouldHideBackground: (BOOL)hideBackground; 38 | 39 | - (void)startTapTutorialWithInfo: (NSString *)infoText 40 | atPoint: (CGPoint)infoPoint 41 | withFingerprintPoint: (CGPoint)touchPoint 42 | shouldHideBackground: (BOOL)hideBackground 43 | completion: (UIViewControllerTutorialCompletionBlock)completion; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /UIlViewController+Tutorial/UIViewController+Tutorial.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Tutorial.m 3 | // UIViewController+Tutorial 4 | // 5 | // Created by Dmitry Klimkin on 27/2/14. 6 | // Copyright (c) 2014 Dmitry Klimkin. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+Tutorial.h" 10 | #import "DKCircleImageView.h" 11 | 12 | #define ScreenWidth [[UIScreen mainScreen] bounds].size.width 13 | #define ScreenHeight [[UIScreen mainScreen] bounds].size.height 14 | #define ApplicationMainColor [UIColor colorWithRed:0.29 green:0.59 blue:0.81 alpha:1] 15 | 16 | @implementation UIViewController (Tutorial) 17 | 18 | - (void)startNavigationTutorial { 19 | 20 | [self startTutorialWithInfo: NSLocalizedString(@"Swipe Right to go back", nil) 21 | atPoint:CGPointMake(ScreenWidth / 2, ScreenHeight / 2 + 80) 22 | withFingerprintStartingPoint:CGPointMake(30, ScreenHeight / 2) 23 | andEndPoint:CGPointMake(ScreenWidth / 2, ScreenHeight / 2) 24 | shouldHideBackground:YES]; 25 | } 26 | 27 | - (void)startShowItemOptionsTutorial { 28 | 29 | [self startTutorialWithInfo:NSLocalizedString(@"Swipe Left to reveal options", nil) 30 | atPoint:CGPointMake(ScreenWidth / 2, 250) 31 | withFingerprintStartingPoint:CGPointMake(ScreenWidth - 60, 30) 32 | andEndPoint:CGPointMake(ScreenWidth - 200, 30) 33 | shouldHideBackground:NO]; 34 | } 35 | 36 | - (void)startCreateNewItemTutorialWithInfo: (NSString *)infoText { 37 | 38 | [self startTutorialWithInfo:infoText 39 | atPoint:CGPointMake(ScreenWidth / 2, 350) 40 | withFingerprintStartingPoint:CGPointMake(ScreenWidth / 2, 150) 41 | andEndPoint:CGPointMake(ScreenWidth / 2, 300) 42 | shouldHideBackground:YES]; 43 | } 44 | 45 | - (void)animateTapForView: (UIView *)view { 46 | 47 | CGRect pathFrame = CGRectMake(-CGRectGetMidX(view.bounds), -CGRectGetMidY(view.bounds), view.bounds.size.width, view.bounds.size.height); 48 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:pathFrame cornerRadius:view.layer.cornerRadius]; 49 | 50 | // accounts for left/right offset and contentOffset of scroll view 51 | CGPoint shapePosition = [view.superview convertPoint:view.center fromView:view.superview]; 52 | 53 | CAShapeLayer *circleShape = [CAShapeLayer layer]; 54 | circleShape.path = path.CGPath; 55 | circleShape.position = shapePosition; 56 | circleShape.fillColor = [UIColor clearColor].CGColor; 57 | circleShape.opacity = 0; 58 | circleShape.strokeColor = [UIColor whiteColor].CGColor; 59 | circleShape.lineWidth = 2.0; 60 | 61 | [view.superview.layer addSublayer:circleShape]; 62 | 63 | CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 64 | scaleAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; 65 | scaleAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(2.5, 2.5, 1)]; 66 | 67 | CABasicAnimation *alphaAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; 68 | alphaAnimation.fromValue = @1; 69 | alphaAnimation.toValue = @0; 70 | 71 | CAAnimationGroup *animation = [CAAnimationGroup animation]; 72 | 73 | animation.animations = @[scaleAnimation, alphaAnimation]; 74 | animation.duration = 0.5f; 75 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 76 | 77 | [circleShape addAnimation:animation forKey:nil]; 78 | } 79 | 80 | - (void)startTapTutorialWithInfo: (NSString *)infoText 81 | atPoint: (CGPoint)infoPoint 82 | withFingerprintPoint: (CGPoint)touchPoint 83 | shouldHideBackground: (BOOL)hideBackground 84 | completion: (UIViewControllerTutorialCompletionBlock)completion{ 85 | 86 | NSString *tutorialKey = [NSString stringWithFormat:@"%@_%@_tutorial_%@", NSStringFromClass ([self class]), NSStringFromSelector(_cmd), infoText]; 87 | 88 | BOOL wasShown = [[NSUserDefaults standardUserDefaults] boolForKey:tutorialKey]; 89 | 90 | if (wasShown) { 91 | return; 92 | } else { 93 | [[NSUserDefaults standardUserDefaults] setBool:YES forKey:tutorialKey]; 94 | } 95 | 96 | UIView *tutorialView = [[UIView alloc] initWithFrame:self.view.bounds]; 97 | 98 | tutorialView.backgroundColor = [ApplicationMainColor colorWithAlphaComponent:hideBackground ? 1.0 : 0.2]; 99 | tutorialView.alpha = 0.0; 100 | 101 | [self.view addSubview: tutorialView]; 102 | 103 | DKCircleImageView *touchView = [[DKCircleImageView alloc] initWithFrame:CGRectMake(0, 0, 70, 70)]; 104 | 105 | touchView.center = touchPoint; 106 | 107 | touchView.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.8]; 108 | 109 | [tutorialView addSubview: touchView]; 110 | 111 | UILabel *infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, ScreenWidth - 40, ScreenHeight / 3)]; 112 | 113 | infoLabel.font = [UIFont systemFontOfSize:30]; 114 | infoLabel.textColor = [UIColor whiteColor]; 115 | infoLabel.backgroundColor = [UIColor clearColor]; 116 | infoLabel.numberOfLines = 0; 117 | infoLabel.lineBreakMode = NSLineBreakByWordWrapping; 118 | infoLabel.textAlignment = NSTextAlignmentCenter; 119 | infoLabel.center = infoPoint; 120 | infoLabel.text = infoText; 121 | 122 | [tutorialView addSubview: infoLabel]; 123 | 124 | self.view.userInteractionEnabled = NO; 125 | 126 | __weak typeof(self) this = self; 127 | 128 | [UIView animateWithDuration:0.5 animations:^{ 129 | tutorialView.alpha = 1.0; 130 | } completion:^(BOOL finished) { 131 | 132 | [this animateTapForView:touchView]; 133 | 134 | [UIView animateWithDuration:1.0 animations:^{ 135 | touchView.alpha = 0.3; 136 | } completion:^(BOOL finished) { 137 | touchView.alpha = 1.0; 138 | 139 | [this animateTapForView:touchView]; 140 | 141 | [UIView animateWithDuration:1.0 animations:^{ 142 | touchView.alpha = 0.3; 143 | } completion:^(BOOL finished) { 144 | 145 | touchView.alpha = 1.0; 146 | 147 | [this animateTapForView:touchView]; 148 | 149 | [UIView animateWithDuration:1.0 animations:^{ 150 | touchView.alpha = 0.0; 151 | infoLabel.alpha = 0.0; 152 | } completion:^(BOOL finished) { 153 | 154 | [UIView animateWithDuration:0.5 animations:^{ 155 | tutorialView.alpha = 0.0; 156 | } completion:^(BOOL finished) { 157 | 158 | [touchView removeFromSuperview]; 159 | [infoLabel removeFromSuperview]; 160 | [tutorialView removeFromSuperview]; 161 | 162 | this.view.userInteractionEnabled = YES; 163 | 164 | if(completion){ 165 | completion(); 166 | } 167 | }]; 168 | }]; 169 | }]; 170 | }]; 171 | }]; 172 | } 173 | 174 | - (void)startTapTutorialWithInfo: (NSString *)infoText 175 | atPoint: (CGPoint)infoPoint 176 | withFingerprintPoint: (CGPoint)touchPoint 177 | shouldHideBackground: (BOOL)hideBackground{ 178 | [self startTapTutorialWithInfo:infoText atPoint:infoPoint withFingerprintPoint:touchPoint shouldHideBackground:hideBackground completion:NULL]; 179 | } 180 | 181 | - (void)startTutorialWithInfo: (NSString *)infoText 182 | atPoint: (CGPoint)infoPoint 183 | withFingerprintStartingPoint: (CGPoint)startPoint 184 | andEndPoint: (CGPoint)endPoint 185 | shouldHideBackground: (BOOL)hideBackground 186 | completion: (UIViewControllerTutorialCompletionBlock)completion{ 187 | NSString *tutorialKey = [NSString stringWithFormat:@"%@_%@_tutorial_%@", NSStringFromClass ([self class]), NSStringFromSelector(_cmd), infoText]; 188 | 189 | BOOL wasShown = [[NSUserDefaults standardUserDefaults] boolForKey:tutorialKey]; 190 | 191 | if (wasShown) { 192 | return; 193 | } else { 194 | [[NSUserDefaults standardUserDefaults] setBool:YES forKey:tutorialKey]; 195 | } 196 | 197 | UIView *tutorialView = [[UIView alloc] initWithFrame:self.view.bounds]; 198 | 199 | tutorialView.backgroundColor = [ApplicationMainColor colorWithAlphaComponent:hideBackground ? 1.0 : 0.2]; 200 | tutorialView.alpha = 0.0; 201 | 202 | [self.view addSubview: tutorialView]; 203 | 204 | DKCircleImageView *touchView = [[DKCircleImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)]; 205 | 206 | touchView.center = startPoint; 207 | 208 | touchView.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.8]; 209 | 210 | [tutorialView addSubview: touchView]; 211 | 212 | UILabel *infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, ScreenWidth - 40, ScreenHeight / 3)]; 213 | 214 | infoLabel.font = [UIFont systemFontOfSize:30]; 215 | infoLabel.textColor = [UIColor whiteColor]; 216 | infoLabel.backgroundColor = [UIColor clearColor]; 217 | infoLabel.numberOfLines = 0; 218 | infoLabel.lineBreakMode = NSLineBreakByWordWrapping; 219 | infoLabel.textAlignment = NSTextAlignmentCenter; 220 | infoLabel.center = infoPoint; 221 | infoLabel.text = infoText; 222 | 223 | [tutorialView addSubview: infoLabel]; 224 | 225 | self.view.userInteractionEnabled = NO; 226 | 227 | __weak typeof(self) this = self; 228 | 229 | [UIView animateWithDuration:0.5 animations:^{ 230 | tutorialView.alpha = 1.0; 231 | } completion:^(BOOL finished) { 232 | [UIView animateWithDuration:1.5 animations:^{ 233 | touchView.center = endPoint; 234 | touchView.alpha = 0.3; 235 | } completion:^(BOOL finished) { 236 | 237 | touchView.center = startPoint; 238 | touchView.alpha = 1.0; 239 | 240 | [UIView animateWithDuration:1.5 animations:^{ 241 | touchView.center = endPoint; 242 | touchView.alpha = 0.3; 243 | } completion:^(BOOL finished) { 244 | 245 | touchView.center = startPoint; 246 | touchView.alpha = 1.0; 247 | 248 | [UIView animateWithDuration:1.5 animations:^{ 249 | touchView.center = endPoint; 250 | touchView.alpha = 0.0; 251 | infoLabel.alpha = 0.0; 252 | } completion:^(BOOL finished) { 253 | 254 | [UIView animateWithDuration:0.5 animations:^{ 255 | tutorialView.alpha = 0.0; 256 | } completion:^(BOOL finished) { 257 | 258 | [touchView removeFromSuperview]; 259 | [infoLabel removeFromSuperview]; 260 | [tutorialView removeFromSuperview]; 261 | 262 | this.view.userInteractionEnabled = YES; 263 | 264 | if(completion){ 265 | completion(); 266 | } 267 | }]; 268 | }]; 269 | }]; 270 | }]; 271 | }]; 272 | } 273 | 274 | - (void)startTutorialWithInfo: (NSString *)infoText 275 | atPoint: (CGPoint)infoPoint 276 | withFingerprintStartingPoint: (CGPoint)startPoint 277 | andEndPoint: (CGPoint)endPoint 278 | shouldHideBackground: (BOOL)hideBackground { 279 | [self startTutorialWithInfo:infoText atPoint:infoPoint withFingerprintStartingPoint:startPoint andEndPoint:endPoint shouldHideBackground:hideBackground completion:NULL]; 280 | } 281 | 282 | @end 283 | -------------------------------------------------------------------------------- /example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kronik/UIViewController-Tutorial/c8d6bf55006ceb8876e218eecff9dd216910510b/example.gif --------------------------------------------------------------------------------