├── .gitignore ├── Dynamic Type.xcodeproj └── project.pbxproj ├── Dynamic Type ├── Dynamic Type-Info.plist ├── Dynamic Type-Prefix.pch ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── LaunchImage.launchimage │ │ ├── Contents.json │ │ ├── Default@2x-568.png │ │ └── Default@2x.png │ ├── icon-scroll.imageset │ │ ├── Contents.json │ │ └── icon-scroll@2x.png │ ├── icon-table.imageset │ │ ├── Contents.json │ │ └── icon-table@2x.png │ └── icon-view.imageset │ │ ├── Contents.json │ │ └── icon-view@2x.png ├── JSAppDelegate.h ├── JSAppDelegate.m ├── JSScrollViewController.h ├── JSScrollViewController.m ├── JSTableViewController.h ├── JSTableViewController.m ├── JSViewController.h ├── JSViewController.m ├── UIFont+AvenirContentSize.h ├── UIFont+AvenirContentSize.m ├── en.lproj │ └── InfoPlist.strings ├── main.m └── mountain_lion.jpg ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | -------------------------------------------------------------------------------- /Dynamic Type.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0320EB6417E0F84D000F192C /* mountain_lion.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 0320EB6317E0F84D000F192C /* mountain_lion.jpg */; }; 11 | 0320EB6717E20626000F192C /* UIFont+AvenirContentSize.m in Sources */ = {isa = PBXBuildFile; fileRef = 0320EB6617E20626000F192C /* UIFont+AvenirContentSize.m */; }; 12 | 037E765617E0D79700E5021D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 037E765517E0D79700E5021D /* Foundation.framework */; }; 13 | 037E765817E0D79700E5021D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 037E765717E0D79700E5021D /* CoreGraphics.framework */; }; 14 | 037E765A17E0D79700E5021D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 037E765917E0D79700E5021D /* UIKit.framework */; }; 15 | 037E766017E0D79700E5021D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 037E765E17E0D79700E5021D /* InfoPlist.strings */; }; 16 | 037E766217E0D79700E5021D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 037E766117E0D79700E5021D /* main.m */; }; 17 | 037E766617E0D79700E5021D /* JSAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 037E766517E0D79700E5021D /* JSAppDelegate.m */; }; 18 | 037E767117E0D79700E5021D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 037E767017E0D79700E5021D /* Images.xcassets */; }; 19 | 037E768F17E0D94D00E5021D /* JSTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 037E768E17E0D94D00E5021D /* JSTableViewController.m */; }; 20 | 037E769217E0D95900E5021D /* JSScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 037E769117E0D95900E5021D /* JSScrollViewController.m */; }; 21 | 037E769517E0D96400E5021D /* JSViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 037E769417E0D96400E5021D /* JSViewController.m */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 0320EB6317E0F84D000F192C /* mountain_lion.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mountain_lion.jpg; sourceTree = ""; }; 26 | 0320EB6517E20626000F192C /* UIFont+AvenirContentSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+AvenirContentSize.h"; sourceTree = ""; }; 27 | 0320EB6617E20626000F192C /* UIFont+AvenirContentSize.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIFont+AvenirContentSize.m"; sourceTree = ""; }; 28 | 037E765217E0D79700E5021D /* Dynamic Type.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Dynamic Type.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 037E765517E0D79700E5021D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 30 | 037E765717E0D79700E5021D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 31 | 037E765917E0D79700E5021D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 32 | 037E765D17E0D79700E5021D /* Dynamic Type-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Dynamic Type-Info.plist"; sourceTree = ""; }; 33 | 037E765F17E0D79700E5021D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 34 | 037E766117E0D79700E5021D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | 037E766317E0D79700E5021D /* Dynamic Type-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Dynamic Type-Prefix.pch"; sourceTree = ""; }; 36 | 037E766417E0D79700E5021D /* JSAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSAppDelegate.h; sourceTree = ""; }; 37 | 037E766517E0D79700E5021D /* JSAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JSAppDelegate.m; sourceTree = ""; }; 38 | 037E767017E0D79700E5021D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 39 | 037E768D17E0D94D00E5021D /* JSTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTableViewController.h; sourceTree = ""; }; 40 | 037E768E17E0D94D00E5021D /* JSTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSTableViewController.m; sourceTree = ""; }; 41 | 037E769017E0D95900E5021D /* JSScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollViewController.h; sourceTree = ""; }; 42 | 037E769117E0D95900E5021D /* JSScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSScrollViewController.m; sourceTree = ""; }; 43 | 037E769317E0D96400E5021D /* JSViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSViewController.h; sourceTree = ""; }; 44 | 037E769417E0D96400E5021D /* JSViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSViewController.m; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 037E764F17E0D79700E5021D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | 037E765817E0D79700E5021D /* CoreGraphics.framework in Frameworks */, 53 | 037E765A17E0D79700E5021D /* UIKit.framework in Frameworks */, 54 | 037E765617E0D79700E5021D /* Foundation.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 037E764917E0D79700E5021D = { 62 | isa = PBXGroup; 63 | children = ( 64 | 037E765B17E0D79700E5021D /* Dynamic Type */, 65 | 037E765417E0D79700E5021D /* Frameworks */, 66 | 037E765317E0D79700E5021D /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 037E765317E0D79700E5021D /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 037E765217E0D79700E5021D /* Dynamic Type.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | 037E765417E0D79700E5021D /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 037E765517E0D79700E5021D /* Foundation.framework */, 82 | 037E765717E0D79700E5021D /* CoreGraphics.framework */, 83 | 037E765917E0D79700E5021D /* UIKit.framework */, 84 | ); 85 | name = Frameworks; 86 | sourceTree = ""; 87 | }; 88 | 037E765B17E0D79700E5021D /* Dynamic Type */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 037E766417E0D79700E5021D /* JSAppDelegate.h */, 92 | 037E766517E0D79700E5021D /* JSAppDelegate.m */, 93 | 037E768D17E0D94D00E5021D /* JSTableViewController.h */, 94 | 037E768E17E0D94D00E5021D /* JSTableViewController.m */, 95 | 037E769017E0D95900E5021D /* JSScrollViewController.h */, 96 | 037E769117E0D95900E5021D /* JSScrollViewController.m */, 97 | 037E769317E0D96400E5021D /* JSViewController.h */, 98 | 037E769417E0D96400E5021D /* JSViewController.m */, 99 | 0320EB6517E20626000F192C /* UIFont+AvenirContentSize.h */, 100 | 0320EB6617E20626000F192C /* UIFont+AvenirContentSize.m */, 101 | 037E767017E0D79700E5021D /* Images.xcassets */, 102 | 0320EB6317E0F84D000F192C /* mountain_lion.jpg */, 103 | 037E765C17E0D79700E5021D /* Supporting Files */, 104 | ); 105 | path = "Dynamic Type"; 106 | sourceTree = ""; 107 | }; 108 | 037E765C17E0D79700E5021D /* Supporting Files */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 037E765D17E0D79700E5021D /* Dynamic Type-Info.plist */, 112 | 037E765E17E0D79700E5021D /* InfoPlist.strings */, 113 | 037E766117E0D79700E5021D /* main.m */, 114 | 037E766317E0D79700E5021D /* Dynamic Type-Prefix.pch */, 115 | ); 116 | name = "Supporting Files"; 117 | sourceTree = ""; 118 | }; 119 | /* End PBXGroup section */ 120 | 121 | /* Begin PBXNativeTarget section */ 122 | 037E765117E0D79700E5021D /* Dynamic Type */ = { 123 | isa = PBXNativeTarget; 124 | buildConfigurationList = 037E768717E0D79700E5021D /* Build configuration list for PBXNativeTarget "Dynamic Type" */; 125 | buildPhases = ( 126 | 037E764E17E0D79700E5021D /* Sources */, 127 | 037E764F17E0D79700E5021D /* Frameworks */, 128 | 037E765017E0D79700E5021D /* Resources */, 129 | ); 130 | buildRules = ( 131 | ); 132 | dependencies = ( 133 | ); 134 | name = "Dynamic Type"; 135 | productName = "Dynamic Type"; 136 | productReference = 037E765217E0D79700E5021D /* Dynamic Type.app */; 137 | productType = "com.apple.product-type.application"; 138 | }; 139 | /* End PBXNativeTarget section */ 140 | 141 | /* Begin PBXProject section */ 142 | 037E764A17E0D79700E5021D /* Project object */ = { 143 | isa = PBXProject; 144 | attributes = { 145 | CLASSPREFIX = JS; 146 | LastUpgradeCheck = 0500; 147 | ORGANIZATIONNAME = "CapTech Consulting"; 148 | }; 149 | buildConfigurationList = 037E764D17E0D79700E5021D /* Build configuration list for PBXProject "Dynamic Type" */; 150 | compatibilityVersion = "Xcode 3.2"; 151 | developmentRegion = English; 152 | hasScannedForEncodings = 0; 153 | knownRegions = ( 154 | en, 155 | Base, 156 | ); 157 | mainGroup = 037E764917E0D79700E5021D; 158 | productRefGroup = 037E765317E0D79700E5021D /* Products */; 159 | projectDirPath = ""; 160 | projectRoot = ""; 161 | targets = ( 162 | 037E765117E0D79700E5021D /* Dynamic Type */, 163 | ); 164 | }; 165 | /* End PBXProject section */ 166 | 167 | /* Begin PBXResourcesBuildPhase section */ 168 | 037E765017E0D79700E5021D /* Resources */ = { 169 | isa = PBXResourcesBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | 0320EB6417E0F84D000F192C /* mountain_lion.jpg in Resources */, 173 | 037E767117E0D79700E5021D /* Images.xcassets in Resources */, 174 | 037E766017E0D79700E5021D /* InfoPlist.strings in Resources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXResourcesBuildPhase section */ 179 | 180 | /* Begin PBXSourcesBuildPhase section */ 181 | 037E764E17E0D79700E5021D /* Sources */ = { 182 | isa = PBXSourcesBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | 0320EB6717E20626000F192C /* UIFont+AvenirContentSize.m in Sources */, 186 | 037E766217E0D79700E5021D /* main.m in Sources */, 187 | 037E769517E0D96400E5021D /* JSViewController.m in Sources */, 188 | 037E766617E0D79700E5021D /* JSAppDelegate.m in Sources */, 189 | 037E769217E0D95900E5021D /* JSScrollViewController.m in Sources */, 190 | 037E768F17E0D94D00E5021D /* JSTableViewController.m in Sources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXSourcesBuildPhase section */ 195 | 196 | /* Begin PBXVariantGroup section */ 197 | 037E765E17E0D79700E5021D /* InfoPlist.strings */ = { 198 | isa = PBXVariantGroup; 199 | children = ( 200 | 037E765F17E0D79700E5021D /* en */, 201 | ); 202 | name = InfoPlist.strings; 203 | sourceTree = ""; 204 | }; 205 | /* End PBXVariantGroup section */ 206 | 207 | /* Begin XCBuildConfiguration section */ 208 | 037E768517E0D79700E5021D /* Debug */ = { 209 | isa = XCBuildConfiguration; 210 | buildSettings = { 211 | ALWAYS_SEARCH_USER_PATHS = NO; 212 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 213 | CLANG_CXX_LIBRARY = "libc++"; 214 | CLANG_ENABLE_MODULES = YES; 215 | CLANG_ENABLE_OBJC_ARC = YES; 216 | CLANG_WARN_BOOL_CONVERSION = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 219 | CLANG_WARN_EMPTY_BODY = YES; 220 | CLANG_WARN_ENUM_CONVERSION = YES; 221 | CLANG_WARN_INT_CONVERSION = YES; 222 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 223 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 224 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 225 | COPY_PHASE_STRIP = NO; 226 | GCC_C_LANGUAGE_STANDARD = gnu99; 227 | GCC_DYNAMIC_NO_PIC = NO; 228 | GCC_OPTIMIZATION_LEVEL = 0; 229 | GCC_PREPROCESSOR_DEFINITIONS = ( 230 | "DEBUG=1", 231 | "$(inherited)", 232 | ); 233 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 240 | ONLY_ACTIVE_ARCH = YES; 241 | SDKROOT = iphoneos; 242 | }; 243 | name = Debug; 244 | }; 245 | 037E768617E0D79700E5021D /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 250 | CLANG_CXX_LIBRARY = "libc++"; 251 | CLANG_ENABLE_MODULES = YES; 252 | CLANG_ENABLE_OBJC_ARC = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 256 | CLANG_WARN_EMPTY_BODY = YES; 257 | CLANG_WARN_ENUM_CONVERSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 261 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 262 | COPY_PHASE_STRIP = YES; 263 | ENABLE_NS_ASSERTIONS = NO; 264 | GCC_C_LANGUAGE_STANDARD = gnu99; 265 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 266 | GCC_WARN_UNDECLARED_SELECTOR = YES; 267 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 268 | GCC_WARN_UNUSED_FUNCTION = YES; 269 | GCC_WARN_UNUSED_VARIABLE = YES; 270 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 271 | SDKROOT = iphoneos; 272 | VALIDATE_PRODUCT = YES; 273 | }; 274 | name = Release; 275 | }; 276 | 037E768817E0D79700E5021D /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 280 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 281 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 282 | GCC_PREFIX_HEADER = "Dynamic Type/Dynamic Type-Prefix.pch"; 283 | INFOPLIST_FILE = "Dynamic Type/Dynamic Type-Info.plist"; 284 | PRODUCT_NAME = "$(TARGET_NAME)"; 285 | WRAPPER_EXTENSION = app; 286 | }; 287 | name = Debug; 288 | }; 289 | 037E768917E0D79700E5021D /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 293 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 294 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 295 | GCC_PREFIX_HEADER = "Dynamic Type/Dynamic Type-Prefix.pch"; 296 | INFOPLIST_FILE = "Dynamic Type/Dynamic Type-Info.plist"; 297 | PRODUCT_NAME = "$(TARGET_NAME)"; 298 | WRAPPER_EXTENSION = app; 299 | }; 300 | name = Release; 301 | }; 302 | /* End XCBuildConfiguration section */ 303 | 304 | /* Begin XCConfigurationList section */ 305 | 037E764D17E0D79700E5021D /* Build configuration list for PBXProject "Dynamic Type" */ = { 306 | isa = XCConfigurationList; 307 | buildConfigurations = ( 308 | 037E768517E0D79700E5021D /* Debug */, 309 | 037E768617E0D79700E5021D /* Release */, 310 | ); 311 | defaultConfigurationIsVisible = 0; 312 | defaultConfigurationName = Release; 313 | }; 314 | 037E768717E0D79700E5021D /* Build configuration list for PBXNativeTarget "Dynamic Type" */ = { 315 | isa = XCConfigurationList; 316 | buildConfigurations = ( 317 | 037E768817E0D79700E5021D /* Debug */, 318 | 037E768917E0D79700E5021D /* Release */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | defaultConfigurationName = Release; 322 | }; 323 | /* End XCConfigurationList section */ 324 | }; 325 | rootObject = 037E764A17E0D79700E5021D /* Project object */; 326 | } 327 | -------------------------------------------------------------------------------- /Dynamic Type/Dynamic Type-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.captechconsulting.${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 | UIStatusBarTintParameters 32 | 33 | UINavigationBar 34 | 35 | Style 36 | UIBarStyleDefault 37 | Translucent 38 | 39 | 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Dynamic Type/Dynamic Type-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_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Dynamic Type/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 | } -------------------------------------------------------------------------------- /Dynamic Type/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 | "filename" : "Default@2x.png", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "extent" : "full-screen", 13 | "idiom" : "iphone", 14 | "subtype" : "retina4", 15 | "filename" : "Default@2x-568.png", 16 | "minimum-system-version" : "7.0", 17 | "orientation" : "portrait", 18 | "scale" : "2x" 19 | } 20 | ], 21 | "info" : { 22 | "version" : 1, 23 | "author" : "xcode" 24 | } 25 | } -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/LaunchImage.launchimage/Default@2x-568.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jszumski/dynamic-type/d6894a7321ec42aa257588320d9339aaa6df08d2/Dynamic Type/Images.xcassets/LaunchImage.launchimage/Default@2x-568.png -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jszumski/dynamic-type/d6894a7321ec42aa257588320d9339aaa6df08d2/Dynamic Type/Images.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/icon-scroll.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon-scroll@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/icon-scroll.imageset/icon-scroll@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jszumski/dynamic-type/d6894a7321ec42aa257588320d9339aaa6df08d2/Dynamic Type/Images.xcassets/icon-scroll.imageset/icon-scroll@2x.png -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/icon-table.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon-table@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/icon-table.imageset/icon-table@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jszumski/dynamic-type/d6894a7321ec42aa257588320d9339aaa6df08d2/Dynamic Type/Images.xcassets/icon-table.imageset/icon-table@2x.png -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/icon-view.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon-view@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Dynamic Type/Images.xcassets/icon-view.imageset/icon-view@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jszumski/dynamic-type/d6894a7321ec42aa257588320d9339aaa6df08d2/Dynamic Type/Images.xcassets/icon-view.imageset/icon-view@2x.png -------------------------------------------------------------------------------- /Dynamic Type/JSAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSAppDelegate.h 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JSAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end -------------------------------------------------------------------------------- /Dynamic Type/JSAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSAppDelegate.m 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import "JSAppDelegate.h" 10 | #import "JSTableViewController.h" 11 | #import "JSScrollViewController.h" 12 | #import "JSViewController.h" 13 | 14 | @implementation JSAppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 18 | 19 | UINavigationController *tableNav = [[UINavigationController alloc] initWithRootViewController:[[JSTableViewController alloc] init]]; 20 | UINavigationController *scrollNav = [[UINavigationController alloc] initWithRootViewController:[[JSScrollViewController alloc] init]]; 21 | UINavigationController *viewNav = [[UINavigationController alloc] initWithRootViewController:[[JSViewController alloc] init]]; 22 | 23 | UITabBarController *tabController = [[UITabBarController alloc] init]; 24 | tabController.viewControllers = @[tableNav, scrollNav, viewNav]; 25 | 26 | self.window.rootViewController = tabController; 27 | [self.window makeKeyAndVisible]; 28 | 29 | return YES; 30 | } 31 | 32 | @end -------------------------------------------------------------------------------- /Dynamic Type/JSScrollViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSScrollViewController.h 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JSScrollViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Dynamic Type/JSScrollViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSScrollViewController.m 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import "JSScrollViewController.h" 10 | 11 | 12 | @interface JSScrollViewController () 13 | 14 | @property (nonatomic,strong) UIScrollView *scrollView; 15 | @property (nonatomic,strong) UILabel *titleLabel; 16 | @property (nonatomic,strong) UIImageView *imageView; 17 | @property (nonatomic,strong) UILabel *bodyLabel; 18 | 19 | @end 20 | 21 | 22 | @implementation JSScrollViewController 23 | 24 | - (id)init { 25 | self = [super init]; 26 | 27 | self.title = @"Scroll View"; 28 | self.tabBarItem.image = [UIImage imageNamed:@"icon-scroll"]; 29 | 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | self.view.backgroundColor = [UIColor whiteColor]; 37 | 38 | self.scrollView = [[UIScrollView alloc] init]; 39 | self.scrollView.translatesAutoresizingMaskIntoConstraints = NO; 40 | [self.view addSubview:self.scrollView]; 41 | 42 | self.titleLabel = [[UILabel alloc] init]; 43 | self.titleLabel.text = @"Mountain Lion (Puma concolor)"; 44 | self.titleLabel.numberOfLines = 0; 45 | self.titleLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.view.bounds) - 40; // 40 = 20pts horizontal padding on each side 46 | self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; 47 | 48 | [self.scrollView addSubview:self.titleLabel]; 49 | 50 | self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mountain_lion.jpg"]]; 51 | self.imageView.translatesAutoresizingMaskIntoConstraints = NO; 52 | [self.scrollView addSubview:self.imageView]; 53 | 54 | self.bodyLabel = [[UILabel alloc] init]; 55 | self.bodyLabel.numberOfLines = 0; 56 | self.bodyLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.view.bounds) - 40; // 40 = 20pts horizontal padding on each side 57 | self.bodyLabel.text = [self bodyText]; 58 | self.bodyLabel.translatesAutoresizingMaskIntoConstraints = NO; 59 | [self.scrollView addSubview:self.bodyLabel]; 60 | 61 | [self applyConstraints]; 62 | [self applyFonts]; 63 | 64 | [[NSNotificationCenter defaultCenter] addObserver:self 65 | selector:@selector(userTextSizeDidChange) 66 | name:UIContentSizeCategoryDidChangeNotification 67 | object:nil]; 68 | } 69 | 70 | - (void)dealloc { 71 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 72 | } 73 | 74 | - (void)userTextSizeDidChange { 75 | [self applyFonts]; 76 | } 77 | 78 | - (void)applyConstraints { 79 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[scrollView]|" 80 | options:kNilOptions 81 | metrics:nil 82 | views:@{@"scrollView": self.scrollView}]]; 83 | 84 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView]|" 85 | options:kNilOptions 86 | metrics:nil 87 | views:@{@"scrollView": self.scrollView}]]; 88 | 89 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[titleLabel(==width)]-|" 90 | options:kNilOptions 91 | metrics:@{@"width": @(self.titleLabel.preferredMaxLayoutWidth)} 92 | views:@{@"titleLabel": self.titleLabel, 93 | @"scrollView": self.scrollView}]]; 94 | 95 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[imageView(==titleLabel)]-|" 96 | options:kNilOptions 97 | metrics:nil 98 | views:@{@"imageView": self.imageView, 99 | @"titleLabel": self.titleLabel}]]; 100 | 101 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[bodyLabel(==titleLabel)]-|" 102 | options:kNilOptions 103 | metrics:nil 104 | views:@{@"bodyLabel": self.bodyLabel, 105 | @"titleLabel": self.titleLabel}]]; 106 | 107 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[titleLabel]-[imageView]-[bodyLabel]-|" 108 | options:kNilOptions 109 | metrics:nil 110 | views:@{@"titleLabel": self.titleLabel, 111 | @"imageView" : self.imageView, 112 | @"bodyLabel": self.bodyLabel}]]; 113 | } 114 | 115 | - (void)applyFonts { 116 | self.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; 117 | self.bodyLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; 118 | } 119 | 120 | 121 | 122 | #pragma mark - Helpers 123 | 124 | - (NSString*)bodyText { 125 | // from http://en.wikipedia.org/wiki/Mountain_lion 126 | return @"The cougar (Puma concolor), also known as the mountain lion, puma, panther, mountain cat, or catamount, is a large cat of the family Felidae native to the Americas. Its range, from the Canadian Yukon to the southern Andes of South America, is the greatest of any large wild terrestrial mammal in the Western Hemisphere. An adaptable, generalist species, the cougar is found in most American habitat types. It is the second heaviest cat in the Western Hemisphere, after the jaguar. Solitary by nature and nocturnal, the cougar is most closely related to smaller felines and is nearer genetically to the domestic cat than true lions.\n\ 127 | \n\ 128 | An excellent stalk-and-ambush predator, the cougar pursues a wide variety of prey. Primary food sources include ungulates such as deer, elk, moose, and bighorn sheep, as well as domestic cattle, horses and sheep, particularly in the northern part of its range. It will also hunt species as small as insects and rodents. This cat prefers habitats with dense underbrush and rocky areas for stalking, but can also live in open areas. The cougar is territorial and survives at low population densities. Individual territory sizes depend on terrain, vegetation, and abundance of prey. While large, it is not always the apex predator in its range, yielding to the jaguar, grey wolf, American black bear, and grizzly bear. It is reclusive and usually avoids people. Fatal attacks on humans are rare, but have been trending upward in recent years as more people enter their territory.\n\ 129 | \n\ 130 | Excessive hunting following European colonization of the Americas and the ongoing human development of cougar habitat has caused populations to drop in most parts of its historical range. In particular, the cougar was extirpated in eastern North America in the beginning of the 20th century, except for an isolated subpopulation in Florida. However, in recent decades, breeding populations have moved east into the far western parts of the Dakotas, Nebraska, and Oklahoma. Transient males have been verified in Minnesota, Wisconsin, Iowa, the Upper Peninsula of Michigan, and Illinois, where a cougar was shot in the city limits of Chicago and, in at least one instance, observed as far east as Connecticut."; 131 | } 132 | 133 | @end -------------------------------------------------------------------------------- /Dynamic Type/JSTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSTableViewController.h 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JSTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Dynamic Type/JSTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSTableViewController.m 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import "JSTableViewController.h" 10 | #import "UIFont+AvenirContentSize.h" 11 | 12 | @interface JSTableViewController() 13 | 14 | @property (nonatomic,strong) NSArray *codenames; 15 | @property (nonatomic,strong) UISegmentedControl *fontSelector; 16 | 17 | @end 18 | 19 | @implementation JSTableViewController 20 | 21 | - (id)init { 22 | self = [super initWithStyle:UITableViewStylePlain]; 23 | 24 | if (self) { 25 | self.title = @"Table View"; 26 | self.tabBarItem.image = [UIImage imageNamed:@"icon-table"]; 27 | 28 | self.codenames = @[@"iOS 1.0 - Alpine", 29 | @"iOS 1.0.x - Heavenly", 30 | @"iOS 1.1 - Little Bear", 31 | @"iOS 1.1.1 - Snowbird", 32 | @"iOS 1.1.2 - Oktoberfest (additional text to make this wrap to new lines)", 33 | @"iOS 2.0 - Big Bear", 34 | @"iOS 2.1 - Sugarbowl", 35 | @"iOS 2.2 - Timberline", 36 | @"iOS 3.0 - Kirkwood", 37 | @"iOS 3.1 - Northstar", 38 | @"iOS 3.2 - Wildcat", 39 | @"iOS 4.0 - Apex", 40 | @"iOS 4.1 - Baker", 41 | @"iOS 4.2 - Jasper", 42 | @"iOS 4.3 - Durango", 43 | @"iOS 5.0 - Telluride", 44 | @"iOS 5.1 - Hoodoo", 45 | @"iOS 6.0 - Sundance", 46 | @"iOS 7.0 - Innsbruck"]; 47 | } 48 | 49 | return self; 50 | } 51 | 52 | - (void)viewDidLoad { 53 | [super viewDidLoad]; 54 | 55 | self.fontSelector = [[UISegmentedControl alloc] initWithItems:@[@"System Font", @"Custom Font"]]; 56 | self.fontSelector.selectedSegmentIndex = 0; 57 | [self.fontSelector addTarget:self action:@selector(userTextSizeDidChange) forControlEvents:UIControlEventValueChanged]; 58 | 59 | self.navigationItem.titleView = self.fontSelector; 60 | 61 | [[NSNotificationCenter defaultCenter] addObserver:self 62 | selector:@selector(userTextSizeDidChange) 63 | name:UIContentSizeCategoryDidChangeNotification 64 | object:nil]; 65 | } 66 | 67 | - (void)dealloc { 68 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 69 | } 70 | 71 | - (void)userTextSizeDidChange { 72 | [self.tableView reloadData]; 73 | } 74 | 75 | 76 | #pragma mark - UI response 77 | 78 | - (void)fontSelectorDidChange:(UISegmentedControl*)segmentedControl { 79 | [self userTextSizeDidChange]; 80 | } 81 | 82 | 83 | #pragma mark - Helpers 84 | 85 | - (UIFont*)fontForBodyTextStyle { 86 | if (self.fontSelector.selectedSegmentIndex == 0) { 87 | return [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; 88 | 89 | } else { 90 | return [UIFont preferredAvenirFontForTextStyle:UIFontTextStyleBody]; 91 | } 92 | } 93 | 94 | 95 | #pragma mark - UITableViewDataSource 96 | 97 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 98 | return 1; 99 | } 100 | 101 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 102 | return [self.codenames count]; 103 | } 104 | 105 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 106 | NSString *codename = self.codenames[indexPath.row]; 107 | CGRect codenameRect = [codename boundingRectWithSize:CGSizeMake(CGRectGetWidth(tableView.bounds) - 40, MAXFLOAT) // 40 = 20pt horizontal padding on each side 108 | options:NSStringDrawingUsesLineFragmentOrigin 109 | attributes:@{NSFontAttributeName: [self fontForBodyTextStyle]} 110 | context:nil]; 111 | 112 | return MAX(44.0f, CGRectGetHeight(CGRectIntegral(codenameRect)) + 20); // 20 = 10pt vertical padding on each end 113 | } 114 | 115 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 116 | static NSString *cellIdentifier = @"CodenameCell"; 117 | 118 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 119 | 120 | if (cell == nil) { 121 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 122 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 123 | cell.textLabel.numberOfLines = 0; 124 | } 125 | 126 | cell.textLabel.text = self.codenames[indexPath.row]; 127 | cell.textLabel.font = [self fontForBodyTextStyle]; 128 | 129 | return cell; 130 | } 131 | 132 | @end -------------------------------------------------------------------------------- /Dynamic Type/JSViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSViewController.h 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JSViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Dynamic Type/JSViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSViewController.m 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import "JSViewController.h" 10 | #import "UIFont+AvenirContentSize.h" 11 | 12 | 13 | @interface JSViewController() 14 | 15 | @property (nonatomic,strong) UILabel *titleLabel; 16 | @property (nonatomic,strong) UILabel *messageLabel; 17 | 18 | @end 19 | 20 | 21 | 22 | @implementation JSViewController 23 | 24 | - (id)init { 25 | self = [super init]; 26 | 27 | self.title = @"View"; 28 | self.tabBarItem.image = [UIImage imageNamed:@"icon-view"]; 29 | 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | self.view.backgroundColor = [UIColor whiteColor]; 37 | 38 | self.titleLabel = [[UILabel alloc] init]; 39 | self.titleLabel.numberOfLines = 0; 40 | self.titleLabel.preferredMaxLayoutWidth = 280; 41 | self.titleLabel.textAlignment = NSTextAlignmentCenter; 42 | self.titleLabel.text = @"This is a plain ol' UIView layout"; 43 | self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; 44 | [self.view addSubview:self.titleLabel]; 45 | 46 | self.messageLabel = [[UILabel alloc] init]; 47 | self.messageLabel.numberOfLines = 0; 48 | self.messageLabel.preferredMaxLayoutWidth = 280; 49 | self.messageLabel.text = @"It doesn't do anything except adjust to content size changes."; 50 | self.messageLabel.translatesAutoresizingMaskIntoConstraints = NO; 51 | [self.view addSubview:self.messageLabel]; 52 | 53 | [self applyConstraints]; 54 | [self applyFonts]; 55 | 56 | [[NSNotificationCenter defaultCenter] addObserver:self 57 | selector:@selector(userTextSizeDidChange) 58 | name:UIContentSizeCategoryDidChangeNotification 59 | object:nil]; 60 | } 61 | 62 | - (void)dealloc { 63 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 64 | } 65 | 66 | - (void)userTextSizeDidChange { 67 | [self applyFonts]; 68 | } 69 | 70 | - (void)applyConstraints { 71 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[titleLabel(==width)]-|" 72 | options:kNilOptions 73 | metrics:@{@"width": @(self.titleLabel.preferredMaxLayoutWidth)} 74 | views:@{@"titleLabel": self.titleLabel}]]; 75 | 76 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[messageLabel(==titleLabel)]-|" 77 | options:kNilOptions 78 | metrics:nil 79 | views:@{@"messageLabel": self.messageLabel, 80 | @"titleLabel": self.titleLabel}]]; 81 | 82 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-100-[titleLabel]-100-[messageLabel]" 83 | options:kNilOptions 84 | metrics:nil 85 | views:@{@"titleLabel": self.titleLabel, 86 | @"messageLabel": self.messageLabel}]]; 87 | } 88 | 89 | - (void)applyFonts { 90 | self.titleLabel.font = [UIFont preferredAvenirFontForTextStyle:UIFontTextStyleHeadline]; 91 | self.messageLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; 92 | } 93 | 94 | @end -------------------------------------------------------------------------------- /Dynamic Type/UIFont+AvenirContentSize.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIFont+AvenirContentSize.h 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski on 9/12/13. 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIFont (AvenirContentSize) 12 | 13 | + (UIFont*)preferredAvenirFontForTextStyle:(NSString*)textStyle; 14 | 15 | @end -------------------------------------------------------------------------------- /Dynamic Type/UIFont+AvenirContentSize.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIFont+AvenirContentSize.m 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski on 9/12/13. 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import "UIFont+AvenirContentSize.h" 10 | 11 | @implementation UIFont (AvenirContentSize) 12 | 13 | + (UIFont *)preferredAvenirFontForTextStyle:(NSString *)textStyle 14 | { 15 | // choose the font size 16 | CGFloat fontSize = 16.f; 17 | NSString *contentSize = [UIApplication sharedApplication].preferredContentSizeCategory; 18 | 19 | static NSString *FONT_NAME_REGULAR = @"Avenir-Book"; 20 | static NSString *FONT_NAME_MEDIUM = @"Avenir-Medium"; 21 | 22 | static dispatch_once_t onceToken; 23 | static NSDictionary *fontSizeOffsetDictionary; 24 | dispatch_once(&onceToken, ^{ 25 | 26 | fontSizeOffsetDictionary = @{ UIContentSizeCategoryExtraSmall : @{ UIFontTextStyleBody : @(-2), 27 | UIFontTextStyleHeadline : @(-2), 28 | UIFontTextStyleSubheadline : @(-4), 29 | UIFontTextStyleCaption1 : @(-5), 30 | UIFontTextStyleCaption2 : @(-5), 31 | UIFontTextStyleFootnote : @(-4) }, 32 | 33 | UIContentSizeCategorySmall : @{ UIFontTextStyleBody : @(-1), 34 | UIFontTextStyleHeadline : @(-1), 35 | UIFontTextStyleSubheadline : @(-3), 36 | UIFontTextStyleCaption1 : @(-5), 37 | UIFontTextStyleCaption2 : @(-5), 38 | UIFontTextStyleFootnote : @(-4) }, 39 | 40 | UIContentSizeCategoryMedium : @{ UIFontTextStyleBody : @(0), 41 | UIFontTextStyleHeadline : @(0), 42 | UIFontTextStyleSubheadline : @(-2), 43 | UIFontTextStyleCaption1 : @(-5), 44 | UIFontTextStyleCaption2 : @(-5), 45 | UIFontTextStyleFootnote : @(-4) }, 46 | 47 | UIContentSizeCategoryLarge : @{ UIFontTextStyleBody : @(1), 48 | UIFontTextStyleHeadline : @(1), 49 | UIFontTextStyleSubheadline : @(-1), 50 | UIFontTextStyleCaption1 : @(-4), 51 | UIFontTextStyleCaption2 : @(-5), 52 | UIFontTextStyleFootnote : @(-3) }, 53 | 54 | UIContentSizeCategoryExtraLarge : @{ UIFontTextStyleBody : @(2), 55 | UIFontTextStyleHeadline : @(2), 56 | UIFontTextStyleSubheadline : @(0), 57 | UIFontTextStyleCaption1 : @(-3), 58 | UIFontTextStyleCaption2 : @(-4), 59 | UIFontTextStyleFootnote : @(-2) }, 60 | 61 | UIContentSizeCategoryExtraExtraLarge : @{ UIFontTextStyleBody : @(3), 62 | UIFontTextStyleHeadline : @(3), 63 | UIFontTextStyleSubheadline : @(1), 64 | UIFontTextStyleCaption1 : @(-2), 65 | UIFontTextStyleCaption2 : @(-3), 66 | UIFontTextStyleFootnote : @(-1) }, 67 | 68 | UIContentSizeCategoryExtraExtraExtraLarge : @{ UIFontTextStyleBody : @(4), 69 | UIFontTextStyleHeadline : @(4), 70 | UIFontTextStyleSubheadline : @(2), 71 | UIFontTextStyleCaption1 : @(-1), 72 | UIFontTextStyleCaption2 : @(-2), 73 | UIFontTextStyleFootnote : @(0) } 74 | }; 75 | }); 76 | 77 | // adjust the default font size based on what the User has set in Settings 78 | CGFloat fontSizeOffset = [fontSizeOffsetDictionary[contentSize][textStyle] doubleValue]; 79 | fontSize += fontSizeOffset; 80 | 81 | // choose the font weight 82 | if ([textStyle isEqualToString:UIFontTextStyleHeadline] || 83 | [textStyle isEqualToString:UIFontTextStyleSubheadline]) { 84 | 85 | return [UIFont fontWithName:FONT_NAME_MEDIUM size:fontSize]; 86 | 87 | } else { 88 | return [UIFont fontWithName:FONT_NAME_REGULAR size:fontSize]; 89 | } 90 | } 91 | 92 | @end -------------------------------------------------------------------------------- /Dynamic Type/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Dynamic Type/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Dynamic Type 4 | // 5 | // Created by John Szumski 6 | // Copyright (c) 2013 CapTech Consulting. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "JSAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([JSAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Dynamic Type/mountain_lion.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jszumski/dynamic-type/d6894a7321ec42aa257588320d9339aaa6df08d2/Dynamic Type/mountain_lion.jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jszumski/dynamic-type/d6894a7321ec42aa257588320d9339aaa6df08d2/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Dynamic Type in iOS 7 2 | ============ 3 | 4 | An iOS app demonstrating Dynamic Type on iOS 7. It includes two example controllers: 5 | 6 | * A `UITableViewController` that can switch between the system font and a custom font. 7 | * A `UIScrollView` that uses Auto Layout to position a title, image, and body text. 8 | 9 | Custom fonts are implemented through a `UIFont` category that can easily be adapted to other projects. 10 | 11 | For more background on Dynamic Type, read the companion blog post for this sample code: [Implementing Dynamic Type on iOS 7][1]. 12 | 13 | [1]: http://johnszumski.com/blog/implementing-dynamic-type-on-ios7 14 | --------------------------------------------------------------------------------