├── .gitignore ├── IBInspectable+AccessibilityIdentifier ├── IBInspectable+AccessibilityIdentifier.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── IBInspectable+AccessibilityIdentifier │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── UIView+MDIBInspectableAccessibilityIdentifier │ │ ├── UIView+IBInspectableAccessibilityIdentifier.h │ │ └── UIView+IBInspectableAccessibilityIdentifier.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── IBInspectable+AccessibilityIdentifierTests │ ├── IBInspectable_AccessibilityIdentifierTests.m │ └── Info.plist └── README.md ├── ICU plural rules ├── ICU-plural-rules-demo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── ICU-plural-rules-demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── ICU plural rules │ │ ├── upluralrules.h │ │ ├── uplurals_demo.h │ │ └── uplurals_demo.m │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── README.md ├── LICENSE ├── MDBottomSnappingCells ├── MDBottomSnappingCells.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── MDBottomSnappingCells │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── BottomSnappingCollectionViewLayout.swift │ ├── CollectionViewCellWithLabel.swift │ ├── Info.plist │ └── ViewController.swift ├── README.md └── bottomsnappingcells.gif ├── README.md └── TableHeaderView+Autolayout ├── TableHeaderView+Autolayout.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── TableHeaderView+Autolayout ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── TableHeaderView+Autolayout-Info.plist ├── TableHeaderView+Autolayout-Prefix.pch ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m └── TableHeaderView+AutolayoutTests ├── TableHeaderView+AutolayoutTests-Info.plist ├── TableHeaderView_AutolayoutTests.m └── en.lproj └── InfoPlist.strings /.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 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | # Generated files 21 | *.o 22 | *.pyc 23 | *.hi 24 | 25 | #Python modules 26 | MANIFEST 27 | dist/ 28 | build/ 29 | 30 | # Backup files 31 | *~.nib 32 | \#*# 33 | .#* 34 | *.swp 35 | *.un~ 36 | 37 | #CocoaPods 38 | Pods 39 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 28A05F001B3D7BB300473EF1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A05EFF1B3D7BB300473EF1 /* main.m */; }; 11 | 28A05F031B3D7BB300473EF1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A05F021B3D7BB300473EF1 /* AppDelegate.m */; }; 12 | 28A05F061B3D7BB300473EF1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A05F051B3D7BB300473EF1 /* ViewController.m */; }; 13 | 28A05F091B3D7BB300473EF1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28A05F071B3D7BB300473EF1 /* Main.storyboard */; }; 14 | 28A05F0B1B3D7BB300473EF1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28A05F0A1B3D7BB300473EF1 /* Images.xcassets */; }; 15 | 28A05F0E1B3D7BB300473EF1 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28A05F0C1B3D7BB300473EF1 /* LaunchScreen.xib */; }; 16 | 28A05F1A1B3D7BB300473EF1 /* IBInspectable_AccessibilityIdentifierTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A05F191B3D7BB300473EF1 /* IBInspectable_AccessibilityIdentifierTests.m */; }; 17 | 28A05F261B3D7C0800473EF1 /* UIView+IBInspectableAccessibilityIdentifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A05F251B3D7C0800473EF1 /* UIView+IBInspectableAccessibilityIdentifier.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 28A05F141B3D7BB300473EF1 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 28A05EF21B3D7BB300473EF1 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 28A05EF91B3D7BB300473EF1; 26 | remoteInfo = "IBInspectable+AccessibilityIdentifier"; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 28A05EFA1B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "IBInspectable+AccessibilityIdentifier.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 28A05EFE1B3D7BB300473EF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 28A05EFF1B3D7BB300473EF1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | 28A05F011B3D7BB300473EF1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | 28A05F021B3D7BB300473EF1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | 28A05F041B3D7BB300473EF1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 37 | 28A05F051B3D7BB300473EF1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 38 | 28A05F081B3D7BB300473EF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 28A05F0A1B3D7BB300473EF1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 28A05F0D1B3D7BB300473EF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | 28A05F131B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifierTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "IBInspectable+AccessibilityIdentifierTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 28A05F181B3D7BB300473EF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 28A05F191B3D7BB300473EF1 /* IBInspectable_AccessibilityIdentifierTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IBInspectable_AccessibilityIdentifierTests.m; sourceTree = ""; }; 44 | 28A05F241B3D7C0800473EF1 /* UIView+IBInspectableAccessibilityIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+IBInspectableAccessibilityIdentifier.h"; sourceTree = ""; }; 45 | 28A05F251B3D7C0800473EF1 /* UIView+IBInspectableAccessibilityIdentifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+IBInspectableAccessibilityIdentifier.m"; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 28A05EF71B3D7BB300473EF1 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | 28A05F101B3D7BB300473EF1 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 28A05EF11B3D7BB300473EF1 = { 67 | isa = PBXGroup; 68 | children = ( 69 | 28A05EFC1B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier */, 70 | 28A05F161B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifierTests */, 71 | 28A05EFB1B3D7BB300473EF1 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | 28A05EFB1B3D7BB300473EF1 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 28A05EFA1B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier.app */, 79 | 28A05F131B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifierTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | 28A05EFC1B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 28A05F231B3D7BF600473EF1 /* UIView+MDIBInspectableAccessibilityIdentifier */, 88 | 28A05F011B3D7BB300473EF1 /* AppDelegate.h */, 89 | 28A05F021B3D7BB300473EF1 /* AppDelegate.m */, 90 | 28A05F041B3D7BB300473EF1 /* ViewController.h */, 91 | 28A05F051B3D7BB300473EF1 /* ViewController.m */, 92 | 28A05F071B3D7BB300473EF1 /* Main.storyboard */, 93 | 28A05F0A1B3D7BB300473EF1 /* Images.xcassets */, 94 | 28A05F0C1B3D7BB300473EF1 /* LaunchScreen.xib */, 95 | 28A05EFD1B3D7BB300473EF1 /* Supporting Files */, 96 | ); 97 | path = "IBInspectable+AccessibilityIdentifier"; 98 | sourceTree = ""; 99 | }; 100 | 28A05EFD1B3D7BB300473EF1 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 28A05EFE1B3D7BB300473EF1 /* Info.plist */, 104 | 28A05EFF1B3D7BB300473EF1 /* main.m */, 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | 28A05F161B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifierTests */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 28A05F191B3D7BB300473EF1 /* IBInspectable_AccessibilityIdentifierTests.m */, 113 | 28A05F171B3D7BB300473EF1 /* Supporting Files */, 114 | ); 115 | path = "IBInspectable+AccessibilityIdentifierTests"; 116 | sourceTree = ""; 117 | }; 118 | 28A05F171B3D7BB300473EF1 /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 28A05F181B3D7BB300473EF1 /* Info.plist */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | 28A05F231B3D7BF600473EF1 /* UIView+MDIBInspectableAccessibilityIdentifier */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 28A05F241B3D7C0800473EF1 /* UIView+IBInspectableAccessibilityIdentifier.h */, 130 | 28A05F251B3D7C0800473EF1 /* UIView+IBInspectableAccessibilityIdentifier.m */, 131 | ); 132 | path = "UIView+MDIBInspectableAccessibilityIdentifier"; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXNativeTarget section */ 138 | 28A05EF91B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 28A05F1D1B3D7BB300473EF1 /* Build configuration list for PBXNativeTarget "IBInspectable+AccessibilityIdentifier" */; 141 | buildPhases = ( 142 | 28A05EF61B3D7BB300473EF1 /* Sources */, 143 | 28A05EF71B3D7BB300473EF1 /* Frameworks */, 144 | 28A05EF81B3D7BB300473EF1 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = "IBInspectable+AccessibilityIdentifier"; 151 | productName = "IBInspectable+AccessibilityIdentifier"; 152 | productReference = 28A05EFA1B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | 28A05F121B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifierTests */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 28A05F201B3D7BB300473EF1 /* Build configuration list for PBXNativeTarget "IBInspectable+AccessibilityIdentifierTests" */; 158 | buildPhases = ( 159 | 28A05F0F1B3D7BB300473EF1 /* Sources */, 160 | 28A05F101B3D7BB300473EF1 /* Frameworks */, 161 | 28A05F111B3D7BB300473EF1 /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | 28A05F151B3D7BB300473EF1 /* PBXTargetDependency */, 167 | ); 168 | name = "IBInspectable+AccessibilityIdentifierTests"; 169 | productName = "IBInspectable+AccessibilityIdentifierTests"; 170 | productReference = 28A05F131B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifierTests.xctest */; 171 | productType = "com.apple.product-type.bundle.unit-test"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | 28A05EF21B3D7BB300473EF1 /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastUpgradeCheck = 0630; 180 | ORGANIZATIONNAME = MDC; 181 | TargetAttributes = { 182 | 28A05EF91B3D7BB300473EF1 = { 183 | CreatedOnToolsVersion = 6.3.1; 184 | }; 185 | 28A05F121B3D7BB300473EF1 = { 186 | CreatedOnToolsVersion = 6.3.1; 187 | TestTargetID = 28A05EF91B3D7BB300473EF1; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 28A05EF51B3D7BB300473EF1 /* Build configuration list for PBXProject "IBInspectable+AccessibilityIdentifier" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = 28A05EF11B3D7BB300473EF1; 200 | productRefGroup = 28A05EFB1B3D7BB300473EF1 /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | 28A05EF91B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier */, 205 | 28A05F121B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifierTests */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | 28A05EF81B3D7BB300473EF1 /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 28A05F091B3D7BB300473EF1 /* Main.storyboard in Resources */, 216 | 28A05F0E1B3D7BB300473EF1 /* LaunchScreen.xib in Resources */, 217 | 28A05F0B1B3D7BB300473EF1 /* Images.xcassets in Resources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | 28A05F111B3D7BB300473EF1 /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXResourcesBuildPhase section */ 229 | 230 | /* Begin PBXSourcesBuildPhase section */ 231 | 28A05EF61B3D7BB300473EF1 /* Sources */ = { 232 | isa = PBXSourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 28A05F261B3D7C0800473EF1 /* UIView+IBInspectableAccessibilityIdentifier.m in Sources */, 236 | 28A05F061B3D7BB300473EF1 /* ViewController.m in Sources */, 237 | 28A05F031B3D7BB300473EF1 /* AppDelegate.m in Sources */, 238 | 28A05F001B3D7BB300473EF1 /* main.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | 28A05F0F1B3D7BB300473EF1 /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 28A05F1A1B3D7BB300473EF1 /* IBInspectable_AccessibilityIdentifierTests.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXTargetDependency section */ 253 | 28A05F151B3D7BB300473EF1 /* PBXTargetDependency */ = { 254 | isa = PBXTargetDependency; 255 | target = 28A05EF91B3D7BB300473EF1 /* IBInspectable+AccessibilityIdentifier */; 256 | targetProxy = 28A05F141B3D7BB300473EF1 /* PBXContainerItemProxy */; 257 | }; 258 | /* End PBXTargetDependency section */ 259 | 260 | /* Begin PBXVariantGroup section */ 261 | 28A05F071B3D7BB300473EF1 /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | 28A05F081B3D7BB300473EF1 /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | 28A05F0C1B3D7BB300473EF1 /* LaunchScreen.xib */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | 28A05F0D1B3D7BB300473EF1 /* Base */, 273 | ); 274 | name = LaunchScreen.xib; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | 28A05F1B1B3D7BB300473EF1 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu99; 302 | GCC_DYNAMIC_NO_PIC = NO; 303 | GCC_NO_COMMON_BLOCKS = YES; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "DEBUG=1", 307 | "$(inherited)", 308 | ); 309 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | }; 321 | name = Debug; 322 | }; 323 | 28A05F1C1B3D7BB300473EF1 /* Release */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ALWAYS_SEARCH_USER_PATHS = NO; 327 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 328 | CLANG_CXX_LIBRARY = "libc++"; 329 | CLANG_ENABLE_MODULES = YES; 330 | CLANG_ENABLE_OBJC_ARC = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_EMPTY_BODY = YES; 335 | CLANG_WARN_ENUM_CONVERSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN_UNREACHABLE_CODE = YES; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 341 | COPY_PHASE_STRIP = NO; 342 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 343 | ENABLE_NS_ASSERTIONS = NO; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | GCC_C_LANGUAGE_STANDARD = gnu99; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 354 | MTL_ENABLE_DEBUG_INFO = NO; 355 | SDKROOT = iphoneos; 356 | VALIDATE_PRODUCT = YES; 357 | }; 358 | name = Release; 359 | }; 360 | 28A05F1E1B3D7BB300473EF1 /* Debug */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | INFOPLIST_FILE = "IBInspectable+AccessibilityIdentifier/Info.plist"; 365 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 366 | PRODUCT_NAME = "$(TARGET_NAME)"; 367 | }; 368 | name = Debug; 369 | }; 370 | 28A05F1F1B3D7BB300473EF1 /* Release */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 374 | INFOPLIST_FILE = "IBInspectable+AccessibilityIdentifier/Info.plist"; 375 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 376 | PRODUCT_NAME = "$(TARGET_NAME)"; 377 | }; 378 | name = Release; 379 | }; 380 | 28A05F211B3D7BB300473EF1 /* Debug */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | BUNDLE_LOADER = "$(TEST_HOST)"; 384 | FRAMEWORK_SEARCH_PATHS = ( 385 | "$(SDKROOT)/Developer/Library/Frameworks", 386 | "$(inherited)", 387 | ); 388 | GCC_PREPROCESSOR_DEFINITIONS = ( 389 | "DEBUG=1", 390 | "$(inherited)", 391 | ); 392 | INFOPLIST_FILE = "IBInspectable+AccessibilityIdentifierTests/Info.plist"; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IBInspectable+AccessibilityIdentifier.app/IBInspectable+AccessibilityIdentifier"; 396 | }; 397 | name = Debug; 398 | }; 399 | 28A05F221B3D7BB300473EF1 /* Release */ = { 400 | isa = XCBuildConfiguration; 401 | buildSettings = { 402 | BUNDLE_LOADER = "$(TEST_HOST)"; 403 | FRAMEWORK_SEARCH_PATHS = ( 404 | "$(SDKROOT)/Developer/Library/Frameworks", 405 | "$(inherited)", 406 | ); 407 | INFOPLIST_FILE = "IBInspectable+AccessibilityIdentifierTests/Info.plist"; 408 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 409 | PRODUCT_NAME = "$(TARGET_NAME)"; 410 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IBInspectable+AccessibilityIdentifier.app/IBInspectable+AccessibilityIdentifier"; 411 | }; 412 | name = Release; 413 | }; 414 | /* End XCBuildConfiguration section */ 415 | 416 | /* Begin XCConfigurationList section */ 417 | 28A05EF51B3D7BB300473EF1 /* Build configuration list for PBXProject "IBInspectable+AccessibilityIdentifier" */ = { 418 | isa = XCConfigurationList; 419 | buildConfigurations = ( 420 | 28A05F1B1B3D7BB300473EF1 /* Debug */, 421 | 28A05F1C1B3D7BB300473EF1 /* Release */, 422 | ); 423 | defaultConfigurationIsVisible = 0; 424 | defaultConfigurationName = Release; 425 | }; 426 | 28A05F1D1B3D7BB300473EF1 /* Build configuration list for PBXNativeTarget "IBInspectable+AccessibilityIdentifier" */ = { 427 | isa = XCConfigurationList; 428 | buildConfigurations = ( 429 | 28A05F1E1B3D7BB300473EF1 /* Debug */, 430 | 28A05F1F1B3D7BB300473EF1 /* Release */, 431 | ); 432 | defaultConfigurationIsVisible = 0; 433 | }; 434 | 28A05F201B3D7BB300473EF1 /* Build configuration list for PBXNativeTarget "IBInspectable+AccessibilityIdentifierTests" */ = { 435 | isa = XCConfigurationList; 436 | buildConfigurations = ( 437 | 28A05F211B3D7BB300473EF1 /* Debug */, 438 | 28A05F221B3D7BB300473EF1 /* Release */, 439 | ); 440 | defaultConfigurationIsVisible = 0; 441 | }; 442 | /* End XCConfigurationList section */ 443 | }; 444 | rootObject = 28A05EF21B3D7BB300473EF1 /* Project object */; 445 | } 446 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // IBInspectable+AccessibilityIdentifier 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // IBInspectable+AccessibilityIdentifier 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | ru.mdc.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/UIView+MDIBInspectableAccessibilityIdentifier/UIView+IBInspectableAccessibilityIdentifier.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+IBInspectableAccessibilityIdentifier.h 3 | // IBInspectable+AccessibilityIdentifier 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (IBInspectableAccessibilityIdentifier) 12 | @property(nonatomic, copy) IBInspectable NSString *accessibilityIdentifier; 13 | @end 14 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/UIView+MDIBInspectableAccessibilityIdentifier/UIView+IBInspectableAccessibilityIdentifier.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+IBInspectableAccessibilityIdentifier.m 3 | // IBInspectable+AccessibilityIdentifier 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import "UIView+IBInspectableAccessibilityIdentifier.h" 10 | 11 | @implementation UIView (IBInspectableAccessibilityIdentifier) 12 | @dynamic accessibilityIdentifier; 13 | @end 14 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // IBInspectable+AccessibilityIdentifier 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // IBInspectable+AccessibilityIdentifier 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | // greenWrapper's accessibilityIdentifier was set by IB 13 | @property (nonatomic, weak) IBOutlet UIView *greenWrapper; 14 | @property (nonatomic, weak) IBOutlet UILabel *identifierTitle; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | 23 | // it was set from IB! 24 | self.identifierTitle.text = self.greenWrapper.accessibilityIdentifier; 25 | } 26 | @end 27 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifier/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // IBInspectable+AccessibilityIdentifier 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifierTests/IBInspectable_AccessibilityIdentifierTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // IBInspectable_AccessibilityIdentifierTests.m 3 | // IBInspectable+AccessibilityIdentifierTests 4 | // 5 | // Created by Mikhail Solodovnichenko on 26/06/15. 6 | // Copyright (c) 2015 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface IBInspectable_AccessibilityIdentifierTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation IBInspectable_AccessibilityIdentifierTests 17 | 18 | - (void)setUp { 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 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/IBInspectable+AccessibilityIdentifierTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | ru.mdc.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /IBInspectable+AccessibilityIdentifier/README.md: -------------------------------------------------------------------------------- 1 | IBInspectable+AccessibilityIdentifier 2 | ============= 3 | 4 | Demonstrates ability to set UIView's accessibilityIdentifier from interface builder via IBInspectable. 5 | 6 | This demo includes UIView category which allows to have currently unavailable in IB accessibilityIdentifier to be configured via Interface Builder. This allows setting accessibilityIdentifier for any UIView subclass via Interface Builder. Category does not introduce any additional properties or overrides, it just extends accessibilityIdentifier with IBInspectable attribute. This technique could be used for other properties or adding additional. 7 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 283D5B4E1BB0A41A00C580D1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 283D5B4D1BB0A41A00C580D1 /* main.m */; }; 11 | 283D5B511BB0A41A00C580D1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 283D5B501BB0A41A00C580D1 /* AppDelegate.m */; }; 12 | 283D5B541BB0A41A00C580D1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 283D5B531BB0A41A00C580D1 /* ViewController.m */; }; 13 | 283D5B571BB0A41A00C580D1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 283D5B551BB0A41A00C580D1 /* Main.storyboard */; }; 14 | 283D5B591BB0A41A00C580D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 283D5B581BB0A41A00C580D1 /* Assets.xcassets */; }; 15 | 283D5B5C1BB0A41A00C580D1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 283D5B5A1BB0A41A00C580D1 /* LaunchScreen.storyboard */; }; 16 | 283D5B641BB0A46800C580D1 /* libicucore.A.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 283D5B631BB0A46800C580D1 /* libicucore.A.tbd */; }; 17 | 283D5B681BB0A58C00C580D1 /* uplurals_demo.m in Sources */ = {isa = PBXBuildFile; fileRef = 283D5B671BB0A58C00C580D1 /* uplurals_demo.m */; settings = {ASSET_TAGS = (); }; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 283D5B491BB0A41A00C580D1 /* ICU-plural-rules-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ICU-plural-rules-demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 283D5B4D1BB0A41A00C580D1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 23 | 283D5B4F1BB0A41A00C580D1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 24 | 283D5B501BB0A41A00C580D1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 25 | 283D5B521BB0A41A00C580D1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 26 | 283D5B531BB0A41A00C580D1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 27 | 283D5B561BB0A41A00C580D1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 283D5B581BB0A41A00C580D1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 283D5B5B1BB0A41A00C580D1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 283D5B5D1BB0A41A00C580D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 283D5B631BB0A46800C580D1 /* libicucore.A.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libicucore.A.tbd; path = usr/lib/libicucore.A.tbd; sourceTree = SDKROOT; }; 32 | 283D5B661BB0A4DE00C580D1 /* upluralrules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = upluralrules.h; sourceTree = ""; }; 33 | 283D5B671BB0A58C00C580D1 /* uplurals_demo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = uplurals_demo.m; sourceTree = ""; }; 34 | 283D5B691BB0A5B300C580D1 /* uplurals_demo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uplurals_demo.h; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 283D5B461BB0A41A00C580D1 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 283D5B641BB0A46800C580D1 /* libicucore.A.tbd in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 283D5B401BB0A41A00C580D1 = { 50 | isa = PBXGroup; 51 | children = ( 52 | 283D5B631BB0A46800C580D1 /* libicucore.A.tbd */, 53 | 283D5B4B1BB0A41A00C580D1 /* ICU-plural-rules-demo */, 54 | 283D5B4A1BB0A41A00C580D1 /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | 283D5B4A1BB0A41A00C580D1 /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 283D5B491BB0A41A00C580D1 /* ICU-plural-rules-demo.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | 283D5B4B1BB0A41A00C580D1 /* ICU-plural-rules-demo */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 283D5B651BB0A4DE00C580D1 /* ICU plural rules */, 70 | 283D5B4F1BB0A41A00C580D1 /* AppDelegate.h */, 71 | 283D5B501BB0A41A00C580D1 /* AppDelegate.m */, 72 | 286F81591BB0A94F00632C44 /* Irrelevant */, 73 | ); 74 | path = "ICU-plural-rules-demo"; 75 | sourceTree = ""; 76 | }; 77 | 283D5B4C1BB0A41A00C580D1 /* Supporting Files */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 283D5B4D1BB0A41A00C580D1 /* main.m */, 81 | ); 82 | name = "Supporting Files"; 83 | sourceTree = ""; 84 | }; 85 | 283D5B651BB0A4DE00C580D1 /* ICU plural rules */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 283D5B661BB0A4DE00C580D1 /* upluralrules.h */, 89 | 283D5B691BB0A5B300C580D1 /* uplurals_demo.h */, 90 | 283D5B671BB0A58C00C580D1 /* uplurals_demo.m */, 91 | ); 92 | path = "ICU plural rules"; 93 | sourceTree = ""; 94 | }; 95 | 286F81591BB0A94F00632C44 /* Irrelevant */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 283D5B4C1BB0A41A00C580D1 /* Supporting Files */, 99 | 283D5B521BB0A41A00C580D1 /* ViewController.h */, 100 | 283D5B531BB0A41A00C580D1 /* ViewController.m */, 101 | 283D5B551BB0A41A00C580D1 /* Main.storyboard */, 102 | 283D5B581BB0A41A00C580D1 /* Assets.xcassets */, 103 | 283D5B5A1BB0A41A00C580D1 /* LaunchScreen.storyboard */, 104 | 283D5B5D1BB0A41A00C580D1 /* Info.plist */, 105 | ); 106 | name = Irrelevant; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 283D5B481BB0A41A00C580D1 /* ICU-plural-rules-demo */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 283D5B601BB0A41A00C580D1 /* Build configuration list for PBXNativeTarget "ICU-plural-rules-demo" */; 115 | buildPhases = ( 116 | 283D5B451BB0A41A00C580D1 /* Sources */, 117 | 283D5B461BB0A41A00C580D1 /* Frameworks */, 118 | 283D5B471BB0A41A00C580D1 /* Resources */, 119 | ); 120 | buildRules = ( 121 | ); 122 | dependencies = ( 123 | ); 124 | name = "ICU-plural-rules-demo"; 125 | productName = "ICU-plural-rules-demo"; 126 | productReference = 283D5B491BB0A41A00C580D1 /* ICU-plural-rules-demo.app */; 127 | productType = "com.apple.product-type.application"; 128 | }; 129 | /* End PBXNativeTarget section */ 130 | 131 | /* Begin PBXProject section */ 132 | 283D5B411BB0A41A00C580D1 /* Project object */ = { 133 | isa = PBXProject; 134 | attributes = { 135 | LastUpgradeCheck = 0700; 136 | TargetAttributes = { 137 | 283D5B481BB0A41A00C580D1 = { 138 | CreatedOnToolsVersion = 7.0; 139 | }; 140 | }; 141 | }; 142 | buildConfigurationList = 283D5B441BB0A41A00C580D1 /* Build configuration list for PBXProject "ICU-plural-rules-demo" */; 143 | compatibilityVersion = "Xcode 3.2"; 144 | developmentRegion = English; 145 | hasScannedForEncodings = 0; 146 | knownRegions = ( 147 | en, 148 | Base, 149 | ); 150 | mainGroup = 283D5B401BB0A41A00C580D1; 151 | productRefGroup = 283D5B4A1BB0A41A00C580D1 /* Products */; 152 | projectDirPath = ""; 153 | projectRoot = ""; 154 | targets = ( 155 | 283D5B481BB0A41A00C580D1 /* ICU-plural-rules-demo */, 156 | ); 157 | }; 158 | /* End PBXProject section */ 159 | 160 | /* Begin PBXResourcesBuildPhase section */ 161 | 283D5B471BB0A41A00C580D1 /* Resources */ = { 162 | isa = PBXResourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | 283D5B5C1BB0A41A00C580D1 /* LaunchScreen.storyboard in Resources */, 166 | 283D5B591BB0A41A00C580D1 /* Assets.xcassets in Resources */, 167 | 283D5B571BB0A41A00C580D1 /* Main.storyboard in Resources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXResourcesBuildPhase section */ 172 | 173 | /* Begin PBXSourcesBuildPhase section */ 174 | 283D5B451BB0A41A00C580D1 /* Sources */ = { 175 | isa = PBXSourcesBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | 283D5B541BB0A41A00C580D1 /* ViewController.m in Sources */, 179 | 283D5B511BB0A41A00C580D1 /* AppDelegate.m in Sources */, 180 | 283D5B681BB0A58C00C580D1 /* uplurals_demo.m in Sources */, 181 | 283D5B4E1BB0A41A00C580D1 /* main.m in Sources */, 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | }; 185 | /* End PBXSourcesBuildPhase section */ 186 | 187 | /* Begin PBXVariantGroup section */ 188 | 283D5B551BB0A41A00C580D1 /* Main.storyboard */ = { 189 | isa = PBXVariantGroup; 190 | children = ( 191 | 283D5B561BB0A41A00C580D1 /* Base */, 192 | ); 193 | name = Main.storyboard; 194 | sourceTree = ""; 195 | }; 196 | 283D5B5A1BB0A41A00C580D1 /* LaunchScreen.storyboard */ = { 197 | isa = PBXVariantGroup; 198 | children = ( 199 | 283D5B5B1BB0A41A00C580D1 /* Base */, 200 | ); 201 | name = LaunchScreen.storyboard; 202 | sourceTree = ""; 203 | }; 204 | /* End PBXVariantGroup section */ 205 | 206 | /* Begin XCBuildConfiguration section */ 207 | 283D5B5E1BB0A41A00C580D1 /* Debug */ = { 208 | isa = XCBuildConfiguration; 209 | buildSettings = { 210 | ALWAYS_SEARCH_USER_PATHS = NO; 211 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 212 | CLANG_CXX_LIBRARY = "libc++"; 213 | CLANG_ENABLE_MODULES = YES; 214 | CLANG_ENABLE_OBJC_ARC = YES; 215 | CLANG_WARN_BOOL_CONVERSION = YES; 216 | CLANG_WARN_CONSTANT_CONVERSION = YES; 217 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 218 | CLANG_WARN_EMPTY_BODY = YES; 219 | CLANG_WARN_ENUM_CONVERSION = YES; 220 | CLANG_WARN_INT_CONVERSION = YES; 221 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 222 | CLANG_WARN_UNREACHABLE_CODE = YES; 223 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 224 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 225 | COPY_PHASE_STRIP = NO; 226 | DEBUG_INFORMATION_FORMAT = dwarf; 227 | ENABLE_STRICT_OBJC_MSGSEND = YES; 228 | ENABLE_TESTABILITY = YES; 229 | GCC_C_LANGUAGE_STANDARD = gnu99; 230 | GCC_DYNAMIC_NO_PIC = NO; 231 | GCC_NO_COMMON_BLOCKS = YES; 232 | GCC_OPTIMIZATION_LEVEL = 0; 233 | GCC_PREPROCESSOR_DEFINITIONS = ( 234 | "DEBUG=1", 235 | "$(inherited)", 236 | ); 237 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 238 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 239 | GCC_WARN_UNDECLARED_SELECTOR = YES; 240 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 241 | GCC_WARN_UNUSED_FUNCTION = YES; 242 | GCC_WARN_UNUSED_VARIABLE = YES; 243 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 244 | MTL_ENABLE_DEBUG_INFO = YES; 245 | ONLY_ACTIVE_ARCH = YES; 246 | SDKROOT = iphoneos; 247 | }; 248 | name = Debug; 249 | }; 250 | 283D5B5F1BB0A41A00C580D1 /* Release */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BOOL_CONVERSION = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 261 | CLANG_WARN_EMPTY_BODY = YES; 262 | CLANG_WARN_ENUM_CONVERSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 268 | COPY_PHASE_STRIP = NO; 269 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 270 | ENABLE_NS_ASSERTIONS = NO; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu99; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 276 | GCC_WARN_UNDECLARED_SELECTOR = YES; 277 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 278 | GCC_WARN_UNUSED_FUNCTION = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 281 | MTL_ENABLE_DEBUG_INFO = NO; 282 | SDKROOT = iphoneos; 283 | VALIDATE_PRODUCT = YES; 284 | }; 285 | name = Release; 286 | }; 287 | 283D5B611BB0A41A00C580D1 /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | INFOPLIST_FILE = "ICU-plural-rules-demo/Info.plist"; 292 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 293 | PRODUCT_BUNDLE_IDENTIFIER = "com.MDC.ICU-plural-rules-demo"; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | }; 296 | name = Debug; 297 | }; 298 | 283D5B621BB0A41A00C580D1 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 302 | INFOPLIST_FILE = "ICU-plural-rules-demo/Info.plist"; 303 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 304 | PRODUCT_BUNDLE_IDENTIFIER = "com.MDC.ICU-plural-rules-demo"; 305 | PRODUCT_NAME = "$(TARGET_NAME)"; 306 | }; 307 | name = Release; 308 | }; 309 | /* End XCBuildConfiguration section */ 310 | 311 | /* Begin XCConfigurationList section */ 312 | 283D5B441BB0A41A00C580D1 /* Build configuration list for PBXProject "ICU-plural-rules-demo" */ = { 313 | isa = XCConfigurationList; 314 | buildConfigurations = ( 315 | 283D5B5E1BB0A41A00C580D1 /* Debug */, 316 | 283D5B5F1BB0A41A00C580D1 /* Release */, 317 | ); 318 | defaultConfigurationIsVisible = 0; 319 | defaultConfigurationName = Release; 320 | }; 321 | 283D5B601BB0A41A00C580D1 /* Build configuration list for PBXNativeTarget "ICU-plural-rules-demo" */ = { 322 | isa = XCConfigurationList; 323 | buildConfigurations = ( 324 | 283D5B611BB0A41A00C580D1 /* Debug */, 325 | 283D5B621BB0A41A00C580D1 /* Release */, 326 | ); 327 | defaultConfigurationIsVisible = 0; 328 | defaultConfigurationName = Release; 329 | }; 330 | /* End XCConfigurationList section */ 331 | }; 332 | rootObject = 283D5B411BB0A41A00C580D1 /* Project object */; 333 | } 334 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ICU-plural-rules-demo 4 | // 5 | // Created by Mikhail Solodovnichenko on 9/21/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ICU-plural-rules-demo 4 | // 5 | // Created by Mikhail Solodovnichenko on 9/21/15. 6 | // 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "uplurals_demo.h" 11 | 12 | @implementation AppDelegate 13 | 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 16 | 17 | [self demonstrate]; 18 | 19 | return YES; 20 | } 21 | 22 | - (void)demonstrate 23 | { 24 | NSLocale *locale = [NSLocale localeWithLocaleIdentifier:@"ru"]; 25 | NSArray *values = @[@0, @1, @2, @5, @1.1]; 26 | 27 | [values enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 28 | double value = [obj doubleValue]; 29 | NSString *form = getPluralForm(value, locale); 30 | 31 | NSLog(@"ICU plural form using '%@' locale for %g is '%@'", locale.localeIdentifier, value, form); 32 | }]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/ICU plural rules/upluralrules.h: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************************** 3 | * Copyright (C) 2010-2012, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ***************************************************************************************** 6 | */ 7 | 8 | #ifndef UPLURALRULES_H 9 | #define UPLURALRULES_H 10 | 11 | #include "unicode/utypes.h" 12 | 13 | #if !UCONFIG_NO_FORMATTING 14 | 15 | #include "unicode/localpointer.h" 16 | 17 | /** 18 | * \file 19 | * \brief C API: Plural rules, select plural keywords for numeric values. 20 | * 21 | * A UPluralRules object defines rules for mapping non-negative numeric 22 | * values onto a small set of keywords. Rules are constructed from a text 23 | * description, consisting of a series of keywords and conditions. 24 | * The uplrules_select function examines each condition in order and 25 | * returns the keyword for the first condition that matches the number. 26 | * If none match, the default rule(other) is returned. 27 | * 28 | * For more information, see the LDML spec, C.11 Language Plural Rules: 29 | * http://www.unicode.org/reports/tr35/#Language_Plural_Rules 30 | * 31 | * Keywords: ICU locale data has 6 predefined values - 32 | * 'zero', 'one', 'two', 'few', 'many' and 'other'. Callers need to check 33 | * the value of keyword returned by the uplrules_select function. 34 | * 35 | * These are based on CLDR Language Plural Rules. For these 36 | * predefined rules, see the CLDR page at 37 | * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html 38 | */ 39 | 40 | /** 41 | * Opaque UPluralRules object for use in C programs. 42 | * @stable ICU 4.8 43 | */ 44 | struct UPluralRules; 45 | typedef struct UPluralRules UPluralRules; /**< C typedef for struct UPluralRules. @stable ICU 4.8 */ 46 | 47 | /** 48 | * Open a new UPluralRules object using the predefined plural rules for a 49 | * given locale. 50 | * @param locale The locale for which the rules are desired. 51 | * @param status A pointer to a UErrorCode to receive any errors. 52 | * @return A UPluralRules for the specified locale, or 0 if an error occurred. 53 | * @stable ICU 4.8 54 | */ 55 | U_DRAFT UPluralRules* U_EXPORT2 56 | uplrules_open(const char *locale, 57 | UErrorCode *status); 58 | 59 | /** 60 | * Close a UPluralRules object. Once closed it may no longer be used. 61 | * @param uplrules The UPluralRules object to close. 62 | * @stable ICU 4.8 63 | */ 64 | U_DRAFT void U_EXPORT2 65 | uplrules_close(UPluralRules *uplrules); 66 | 67 | 68 | #if U_SHOW_CPLUSPLUS_API 69 | 70 | U_NAMESPACE_BEGIN 71 | 72 | /** 73 | * \class LocalUPluralRulesPointer 74 | * "Smart pointer" class, closes a UPluralRules via uplrules_close(). 75 | * For most methods see the LocalPointerBase base class. 76 | * 77 | * @see LocalPointerBase 78 | * @see LocalPointer 79 | * @stable ICU 4.8 80 | */ 81 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUPluralRulesPointer, UPluralRules, uplrules_close); 82 | 83 | U_NAMESPACE_END 84 | 85 | #endif 86 | 87 | 88 | /** 89 | * Given a number, returns the keyword of the first rule that 90 | * applies to the number, according to the supplied UPluralRules object. 91 | * @param uplrules The UPluralRules object specifying the rules. 92 | * @param number The number for which the rule has to be determined. 93 | * @param keyword The keyword of the rule that applies to number. 94 | * @param capacity The capacity of keyword. 95 | * @param status A pointer to a UErrorCode to receive any errors. 96 | * @return The length of keyword. 97 | * @stable ICU 4.8 98 | */ 99 | U_DRAFT int32_t U_EXPORT2 100 | uplrules_select(const UPluralRules *uplrules, 101 | double number, 102 | UChar *keyword, int32_t capacity, 103 | UErrorCode *status); 104 | 105 | #endif /* #if !UCONFIG_NO_FORMATTING */ 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/ICU plural rules/uplurals_demo.h: -------------------------------------------------------------------------------- 1 | // 2 | // uplurals_demo.h 3 | // ICU-plural-rules-demo 4 | // 5 | // Created by Mikhail Solodovnichenko on 9/21/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * Returns plural form for given value according to plural 13 | * rules for given locale. Rules are described here: http://cldr.unicode.org/index/cldr-spec/plural-rules 14 | * 15 | * @param value Number for which the rule has to be determined. 16 | * @param locale Locale for which plural rules are desired. 17 | * 18 | * @return ICU plural form. 19 | */ 20 | NSString *getPluralForm(double value, NSLocale *locale); 21 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/ICU plural rules/uplurals_demo.m: -------------------------------------------------------------------------------- 1 | // 2 | // uplurals_demo.m 3 | // ICU-plural-rules-demo 4 | // 5 | // Created by Mikhail Solodovnichenko on 9/21/15. 6 | // 7 | // 8 | 9 | #import "uplurals_demo.h" 10 | #import "upluralrules.h" 11 | 12 | NSString *getPluralForm(double value, NSLocale *locale) 13 | { 14 | NSString *localeIdentifier = locale.localeIdentifier; 15 | 16 | // fallback to the language app is probably running in 17 | if(localeIdentifier == nil) 18 | { 19 | localeIdentifier = [[[NSBundle mainBundle] preferredLocalizations] firstObject]; 20 | } 21 | 22 | // fallback to english if something is really weird 23 | if(localeIdentifier == nil) 24 | { 25 | localeIdentifier = @"en"; 26 | } 27 | 28 | NSString *form = nil; 29 | 30 | UErrorCode status = U_ZERO_ERROR; 31 | // get plural rules for locale, guess this could be cached and could be expensive 32 | UPluralRules *pluralRules = uplrules_open([localeIdentifier cStringUsingEncoding:NSASCIIStringEncoding], &status); 33 | 34 | if(U_SUCCESS(status) && pluralRules != NULL) 35 | { 36 | status = U_ZERO_ERROR; 37 | int32_t capacity = 16; // fancy random capacity so that the biggest keyword could fit 38 | UChar keyword[capacity]; 39 | 40 | // use plural rules to obtain plural form for value 41 | int32_t length = uplrules_select(pluralRules, value, keyword, capacity, &status); 42 | if(length > 0) 43 | { 44 | form = [[NSString alloc] initWithCharacters:keyword length:length]; 45 | } 46 | 47 | uplrules_close(pluralRules); 48 | } 49 | 50 | // fallback to form "other" if something went wrong 51 | return form ?: @"other"; 52 | } -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ICU-plural-rules-demo 4 | // 5 | // Created by Mikhail Solodovnichenko on 9/21/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ICU-plural-rules-demo 4 | // 5 | // Created by Mikhail Solodovnichenko on 9/21/15. 6 | // 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ICU plural rules/ICU-plural-rules-demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ICU-plural-rules-demo 4 | // 5 | // Created by Mikhail Solodovnichenko on 9/21/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ICU plural rules/README.md: -------------------------------------------------------------------------------- 1 | ICU plural rules 2 | ============= 3 | 4 | Demonstrates number plural form determination via [ICU](http://site.icu-project.org/). Apple uses something like that to select correct string from `.stringsdict`. 5 | 6 | Apple uses ICU's `uplrules_select` and friends for plural form selection, so I desided to try to access that features. 7 | Apple supplies required object code with `CoreFoundation` in `libicucore.A.dylib`. 8 | Unfortunately Apple does not provide **upluralrules.h** with required functions, so I had to add them by myself. 9 | 10 | For more details see [Understanding iOS internationalization](http://maniak-dobrii.com/understanding-ios-internationalization/). 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 283CADFB1D15C52C000DE3AB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 283CADFA1D15C52C000DE3AB /* AppDelegate.swift */; }; 11 | 283CADFD1D15C52C000DE3AB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 283CADFC1D15C52C000DE3AB /* ViewController.swift */; }; 12 | 283CAE001D15C52C000DE3AB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 283CADFE1D15C52C000DE3AB /* Main.storyboard */; }; 13 | 283CAE021D15C52C000DE3AB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 283CAE011D15C52C000DE3AB /* Assets.xcassets */; }; 14 | 283CAE051D15C52C000DE3AB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 283CAE031D15C52C000DE3AB /* LaunchScreen.storyboard */; }; 15 | 283CAE0D1D15C5F9000DE3AB /* BottomSnappingCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 283CAE0C1D15C5F9000DE3AB /* BottomSnappingCollectionViewLayout.swift */; }; 16 | 28EDE56A1D189A780070DD50 /* CollectionViewCellWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28EDE5691D189A780070DD50 /* CollectionViewCellWithLabel.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 283CADF71D15C52C000DE3AB /* MDBottomSnappingCells.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MDBottomSnappingCells.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 283CADFA1D15C52C000DE3AB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 283CADFC1D15C52C000DE3AB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 283CADFF1D15C52C000DE3AB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 283CAE011D15C52C000DE3AB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 283CAE041D15C52C000DE3AB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 283CAE061D15C52C000DE3AB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 283CAE0C1D15C5F9000DE3AB /* BottomSnappingCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomSnappingCollectionViewLayout.swift; sourceTree = ""; }; 28 | 28EDE5691D189A780070DD50 /* CollectionViewCellWithLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewCellWithLabel.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 283CADF41D15C52C000DE3AB /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 283CADEE1D15C52C000DE3AB = { 43 | isa = PBXGroup; 44 | children = ( 45 | 283CADF91D15C52C000DE3AB /* MDBottomSnappingCells */, 46 | 283CADF81D15C52C000DE3AB /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 283CADF81D15C52C000DE3AB /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 283CADF71D15C52C000DE3AB /* MDBottomSnappingCells.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 283CADF91D15C52C000DE3AB /* MDBottomSnappingCells */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 283CADFC1D15C52C000DE3AB /* ViewController.swift */, 62 | 283CAE0C1D15C5F9000DE3AB /* BottomSnappingCollectionViewLayout.swift */, 63 | 283CAE0E1D15C60D000DE3AB /* Irrelevant */, 64 | ); 65 | path = MDBottomSnappingCells; 66 | sourceTree = ""; 67 | }; 68 | 283CAE0E1D15C60D000DE3AB /* Irrelevant */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 28EDE5691D189A780070DD50 /* CollectionViewCellWithLabel.swift */, 72 | 283CADFA1D15C52C000DE3AB /* AppDelegate.swift */, 73 | 283CADFE1D15C52C000DE3AB /* Main.storyboard */, 74 | 283CAE011D15C52C000DE3AB /* Assets.xcassets */, 75 | 283CAE031D15C52C000DE3AB /* LaunchScreen.storyboard */, 76 | 283CAE061D15C52C000DE3AB /* Info.plist */, 77 | ); 78 | name = Irrelevant; 79 | sourceTree = ""; 80 | }; 81 | /* End PBXGroup section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | 283CADF61D15C52C000DE3AB /* MDBottomSnappingCells */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = 283CAE091D15C52C000DE3AB /* Build configuration list for PBXNativeTarget "MDBottomSnappingCells" */; 87 | buildPhases = ( 88 | 283CADF31D15C52C000DE3AB /* Sources */, 89 | 283CADF41D15C52C000DE3AB /* Frameworks */, 90 | 283CADF51D15C52C000DE3AB /* Resources */, 91 | ); 92 | buildRules = ( 93 | ); 94 | dependencies = ( 95 | ); 96 | name = MDBottomSnappingCells; 97 | productName = MDBottomSnappingCells; 98 | productReference = 283CADF71D15C52C000DE3AB /* MDBottomSnappingCells.app */; 99 | productType = "com.apple.product-type.application"; 100 | }; 101 | /* End PBXNativeTarget section */ 102 | 103 | /* Begin PBXProject section */ 104 | 283CADEF1D15C52C000DE3AB /* Project object */ = { 105 | isa = PBXProject; 106 | attributes = { 107 | LastSwiftUpdateCheck = 0800; 108 | LastUpgradeCheck = 0800; 109 | ORGANIZATIONNAME = MANIAK_dobrii; 110 | TargetAttributes = { 111 | 283CADF61D15C52C000DE3AB = { 112 | CreatedOnToolsVersion = 8.0; 113 | ProvisioningStyle = Automatic; 114 | }; 115 | }; 116 | }; 117 | buildConfigurationList = 283CADF21D15C52C000DE3AB /* Build configuration list for PBXProject "MDBottomSnappingCells" */; 118 | compatibilityVersion = "Xcode 3.2"; 119 | developmentRegion = English; 120 | hasScannedForEncodings = 0; 121 | knownRegions = ( 122 | en, 123 | Base, 124 | ); 125 | mainGroup = 283CADEE1D15C52C000DE3AB; 126 | productRefGroup = 283CADF81D15C52C000DE3AB /* Products */; 127 | projectDirPath = ""; 128 | projectRoot = ""; 129 | targets = ( 130 | 283CADF61D15C52C000DE3AB /* MDBottomSnappingCells */, 131 | ); 132 | }; 133 | /* End PBXProject section */ 134 | 135 | /* Begin PBXResourcesBuildPhase section */ 136 | 283CADF51D15C52C000DE3AB /* Resources */ = { 137 | isa = PBXResourcesBuildPhase; 138 | buildActionMask = 2147483647; 139 | files = ( 140 | 283CAE051D15C52C000DE3AB /* LaunchScreen.storyboard in Resources */, 141 | 283CAE021D15C52C000DE3AB /* Assets.xcassets in Resources */, 142 | 283CAE001D15C52C000DE3AB /* Main.storyboard in Resources */, 143 | ); 144 | runOnlyForDeploymentPostprocessing = 0; 145 | }; 146 | /* End PBXResourcesBuildPhase section */ 147 | 148 | /* Begin PBXSourcesBuildPhase section */ 149 | 283CADF31D15C52C000DE3AB /* Sources */ = { 150 | isa = PBXSourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | 283CAE0D1D15C5F9000DE3AB /* BottomSnappingCollectionViewLayout.swift in Sources */, 154 | 28EDE56A1D189A780070DD50 /* CollectionViewCellWithLabel.swift in Sources */, 155 | 283CADFD1D15C52C000DE3AB /* ViewController.swift in Sources */, 156 | 283CADFB1D15C52C000DE3AB /* AppDelegate.swift in Sources */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | /* End PBXSourcesBuildPhase section */ 161 | 162 | /* Begin PBXVariantGroup section */ 163 | 283CADFE1D15C52C000DE3AB /* Main.storyboard */ = { 164 | isa = PBXVariantGroup; 165 | children = ( 166 | 283CADFF1D15C52C000DE3AB /* Base */, 167 | ); 168 | name = Main.storyboard; 169 | sourceTree = ""; 170 | }; 171 | 283CAE031D15C52C000DE3AB /* LaunchScreen.storyboard */ = { 172 | isa = PBXVariantGroup; 173 | children = ( 174 | 283CAE041D15C52C000DE3AB /* Base */, 175 | ); 176 | name = LaunchScreen.storyboard; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXVariantGroup section */ 180 | 181 | /* Begin XCBuildConfiguration section */ 182 | 283CAE071D15C52C000DE3AB /* Debug */ = { 183 | isa = XCBuildConfiguration; 184 | buildSettings = { 185 | ALWAYS_SEARCH_USER_PATHS = NO; 186 | CLANG_ANALYZER_NONNULL = YES; 187 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 188 | CLANG_CXX_LIBRARY = "libc++"; 189 | CLANG_ENABLE_MODULES = YES; 190 | CLANG_ENABLE_OBJC_ARC = YES; 191 | CLANG_WARN_BOOL_CONVERSION = YES; 192 | CLANG_WARN_CONSTANT_CONVERSION = YES; 193 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 194 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 195 | CLANG_WARN_EMPTY_BODY = YES; 196 | CLANG_WARN_ENUM_CONVERSION = YES; 197 | CLANG_WARN_INT_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_UNREACHABLE_CODE = YES; 200 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 201 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 202 | COPY_PHASE_STRIP = NO; 203 | DEBUG_INFORMATION_FORMAT = dwarf; 204 | ENABLE_STRICT_OBJC_MSGSEND = YES; 205 | ENABLE_TESTABILITY = YES; 206 | GCC_C_LANGUAGE_STANDARD = gnu99; 207 | GCC_DYNAMIC_NO_PIC = NO; 208 | GCC_NO_COMMON_BLOCKS = YES; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 215 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 216 | GCC_WARN_UNDECLARED_SELECTOR = YES; 217 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 218 | GCC_WARN_UNUSED_FUNCTION = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 221 | MTL_ENABLE_DEBUG_INFO = YES; 222 | ONLY_ACTIVE_ARCH = YES; 223 | SDKROOT = iphoneos; 224 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 225 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 226 | }; 227 | name = Debug; 228 | }; 229 | 283CAE081D15C52C000DE3AB /* Release */ = { 230 | isa = XCBuildConfiguration; 231 | buildSettings = { 232 | ALWAYS_SEARCH_USER_PATHS = NO; 233 | CLANG_ANALYZER_NONNULL = YES; 234 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 235 | CLANG_CXX_LIBRARY = "libc++"; 236 | CLANG_ENABLE_MODULES = YES; 237 | CLANG_ENABLE_OBJC_ARC = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_CONSTANT_CONVERSION = YES; 240 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 241 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 242 | CLANG_WARN_EMPTY_BODY = YES; 243 | CLANG_WARN_ENUM_CONVERSION = YES; 244 | CLANG_WARN_INT_CONVERSION = YES; 245 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 246 | CLANG_WARN_UNREACHABLE_CODE = YES; 247 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 248 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 249 | COPY_PHASE_STRIP = NO; 250 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 251 | ENABLE_NS_ASSERTIONS = NO; 252 | ENABLE_STRICT_OBJC_MSGSEND = YES; 253 | GCC_C_LANGUAGE_STANDARD = gnu99; 254 | GCC_NO_COMMON_BLOCKS = YES; 255 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 256 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 257 | GCC_WARN_UNDECLARED_SELECTOR = YES; 258 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 259 | GCC_WARN_UNUSED_FUNCTION = YES; 260 | GCC_WARN_UNUSED_VARIABLE = YES; 261 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 262 | MTL_ENABLE_DEBUG_INFO = NO; 263 | SDKROOT = iphoneos; 264 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 265 | VALIDATE_PRODUCT = YES; 266 | }; 267 | name = Release; 268 | }; 269 | 283CAE0A1D15C52C000DE3AB /* Debug */ = { 270 | isa = XCBuildConfiguration; 271 | buildSettings = { 272 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 273 | INFOPLIST_FILE = MDBottomSnappingCells/Info.plist; 274 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 275 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 276 | PRODUCT_BUNDLE_IDENTIFIER = com.MDC.MDBottomSnappingCells; 277 | PRODUCT_NAME = "$(TARGET_NAME)"; 278 | SWIFT_VERSION = 3.0; 279 | }; 280 | name = Debug; 281 | }; 282 | 283CAE0B1D15C52C000DE3AB /* Release */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 286 | INFOPLIST_FILE = MDBottomSnappingCells/Info.plist; 287 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 288 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 289 | PRODUCT_BUNDLE_IDENTIFIER = com.MDC.MDBottomSnappingCells; 290 | PRODUCT_NAME = "$(TARGET_NAME)"; 291 | SWIFT_VERSION = 3.0; 292 | }; 293 | name = Release; 294 | }; 295 | /* End XCBuildConfiguration section */ 296 | 297 | /* Begin XCConfigurationList section */ 298 | 283CADF21D15C52C000DE3AB /* Build configuration list for PBXProject "MDBottomSnappingCells" */ = { 299 | isa = XCConfigurationList; 300 | buildConfigurations = ( 301 | 283CAE071D15C52C000DE3AB /* Debug */, 302 | 283CAE081D15C52C000DE3AB /* Release */, 303 | ); 304 | defaultConfigurationIsVisible = 0; 305 | defaultConfigurationName = Release; 306 | }; 307 | 283CAE091D15C52C000DE3AB /* Build configuration list for PBXNativeTarget "MDBottomSnappingCells" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 283CAE0A1D15C52C000DE3AB /* Debug */, 311 | 283CAE0B1D15C52C000DE3AB /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | /* End XCConfigurationList section */ 317 | }; 318 | rootObject = 283CADEF1D15C52C000DE3AB /* Project object */; 319 | } 320 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MDBottomSnappingCells 4 | // 5 | // Created by Mikhail Solodovnichenko on 6/18/16. 6 | // Copyright © 2016 MANIAK_dobrii. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/BottomSnappingCollectionViewLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BottomSnappingCollectionViewLayout.swift 3 | // MDBottomSnappingCells 4 | // 5 | // Created by Mikhail Solodovnichenko on 6/18/16. 6 | // Copyright © 2016 MANIAK_dobrii. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class BottomSnappingCollectionViewLayout: UICollectionViewFlowLayout { 12 | override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { 13 | // Do we need to stick cells to the bottom or not 14 | var shiftDownNeeded = false 15 | 16 | // Size of all cells without modifications 17 | let allContentSize = super.collectionViewContentSize() 18 | 19 | // If there are not enough cells to fill collection view vertically we shift them down 20 | let diff = self.collectionView!.bounds.size.height - allContentSize.height 21 | if Double(diff) > DBL_EPSILON { 22 | shiftDownNeeded = true 23 | } 24 | 25 | // Ask for common attributes 26 | let attributes = super.layoutAttributesForElements(in: rect) 27 | 28 | if let attributes = attributes { 29 | if shiftDownNeeded { 30 | for element in attributes { 31 | let frame = element.frame; 32 | // shift all the cells down by the difference of heights 33 | element.frame = frame.offsetBy(dx: 0, dy: diff); 34 | } 35 | } 36 | } 37 | 38 | return attributes; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/CollectionViewCellWithLabel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCellWithLabel.swift 3 | // MDBottomSnappingCells 4 | // 5 | // Created by Mikhail Solodovnichenko on 6/21/16. 6 | // Copyright © 2016 MANIAK_dobrii. All rights reserved. 7 | // 8 | 9 | 10 | /* 11 | Just a plain UICollectionViewCell subclass that has UILabel in the center 12 | */ 13 | 14 | import UIKit 15 | 16 | class CollectionViewCellWithLabel: UICollectionViewCell { 17 | 18 | var label: UILabel? 19 | 20 | override init(frame: CGRect) { 21 | super.init(frame: frame) 22 | 23 | self.setupLabel() 24 | } 25 | 26 | required init?(coder aDecoder: NSCoder) { 27 | super.init(coder: aDecoder) 28 | 29 | self.setupLabel() 30 | } 31 | 32 | func setupLabel() { 33 | self.label = UILabel(frame: CGRect.zero) 34 | 35 | if let label = self.label { 36 | label.textAlignment = .center 37 | 38 | label.translatesAutoresizingMaskIntoConstraints = false 39 | self.contentView.addSubview(label) 40 | 41 | // align label from the left and right 42 | self.contentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[label]-0-|", 43 | options: NSLayoutFormatOptions(rawValue: 0), 44 | metrics: nil, 45 | views: ["label": label])); 46 | 47 | // align label from the top and bottom 48 | self.contentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[label]-0-|", 49 | options: NSLayoutFormatOptions(rawValue: 0), 50 | metrics: nil, 51 | views: ["label": label])); 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/MDBottomSnappingCells/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // MDBottomSnappingCells 4 | // 5 | // Created by Mikhail Solodovnichenko on 6/18/16. 6 | // Copyright © 2016 MANIAK_dobrii. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UICollectionViewDelegateFlowLayout { 12 | var collectionView: UICollectionView? 13 | var controlButtonsView: UIView? 14 | var numberOfItems: Int = 3 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | setupCollectionView() 20 | } 21 | 22 | func setupCollectionView() { 23 | // Setting up collection view with special layout 24 | // This makes the whole point of this demo 25 | let bottomSnappingLayout = BottomSnappingCollectionViewLayout() 26 | self.collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: bottomSnappingLayout) 27 | 28 | // nothing interesting there 29 | configureOtherCollectionViewStuff() 30 | } 31 | 32 | // MARK - UICollectionViewDelegate 33 | func collectionView(_ collectionView: UICollectionView, 34 | layout collectionViewLayout: UICollectionViewLayout, 35 | sizeForItemAt indexPath: IndexPath) -> CGSize { 36 | // This makes items look like UITableViewCells in terms of the width 37 | return CGSize(width: collectionView.bounds.size.width, height: 44.0) 38 | } 39 | 40 | // This one is just to make demo more interactive and expressive 41 | func updateNumberOfItems(dif: Int) { 42 | self.numberOfItems += dif 43 | 44 | if self.numberOfItems < 0 { 45 | self.numberOfItems = 0 46 | } 47 | 48 | self.collectionView?.reloadData() 49 | } 50 | } 51 | 52 | 53 | // Other irrelevant collection view stuff 54 | extension ViewController : UICollectionViewDataSource { 55 | 56 | // Tons of boilerplate configuration, nothing interesting here at all 57 | func configureOtherCollectionViewStuff() { 58 | self.controlButtonsView = UIView(frame: CGRect.zero) 59 | self.controlButtonsView?.translatesAutoresizingMaskIntoConstraints = false 60 | self.configureControlButtons(inView: self.controlButtonsView!) 61 | 62 | self.view.addSubview(self.controlButtonsView!) 63 | 64 | // Add to view hierachy and create constraints 65 | self.collectionView?.translatesAutoresizingMaskIntoConstraints = false 66 | 67 | self.view.addSubview(self.collectionView!) 68 | 69 | let views = ["collectionView" : self.collectionView!, "controlButtonsView" : self.controlButtonsView!] 70 | self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[collectionView]-0-|", 71 | options: NSLayoutFormatOptions(rawValue: 0), 72 | metrics: nil, 73 | views: views)) 74 | self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[controlButtonsView]-0-|", 75 | options: NSLayoutFormatOptions(rawValue: 0), 76 | metrics: nil, 77 | views: views)) 78 | self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[collectionView]-[controlButtonsView(60)]-0-|", 79 | options: NSLayoutFormatOptions(rawValue: 0), 80 | metrics: nil, 81 | views: views)) 82 | 83 | self.collectionView?.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1) 84 | self.collectionView?.alwaysBounceVertical = true 85 | 86 | self.collectionView?.register(CollectionViewCellWithLabel.self, forCellWithReuseIdentifier: "cell") 87 | self.collectionView?.dataSource = self 88 | self.collectionView?.delegate = self 89 | } 90 | 91 | func configureControlButtons(inView superview:UIView) { 92 | let incButton = UIButton(frame: CGRect.zero) 93 | incButton.translatesAutoresizingMaskIntoConstraints = false 94 | incButton.addTarget(self, action: #selector(ViewController.onIncButtonTapped(_:)), for: .touchUpInside) 95 | incButton.setTitle("+", for: UIControlState(rawValue: 0)) // normal is missing, filed rdar://26903126 96 | incButton.setTitleColor(#colorLiteral(red: 0, green: 0, blue: 0, alpha: 1), for: UIControlState(rawValue: 0)) 97 | 98 | let decButton = UIButton(frame: CGRect.zero) 99 | decButton.translatesAutoresizingMaskIntoConstraints = false 100 | decButton.addTarget(self, action: #selector(ViewController.onDecButtonTapped(_:)), for: .touchUpInside) 101 | decButton.setTitle("-", for: UIControlState(rawValue: 0)) // normal is missing, filed rdar://26903126 102 | decButton.setTitleColor(#colorLiteral(red: 0, green: 0, blue: 0, alpha: 1), for: UIControlState(rawValue: 0)) 103 | 104 | superview.addSubview(incButton) 105 | superview.addSubview(decButton) 106 | 107 | let views = ["incButton" : incButton, "decButton" : decButton] 108 | superview.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[incButton(decButton)]-0-[decButton]-0-|", 109 | options: NSLayoutFormatOptions(rawValue: 0), 110 | metrics: nil, 111 | views: views)); 112 | superview.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[incButton]-0-|", 113 | options: NSLayoutFormatOptions(rawValue: 0), 114 | metrics: nil, 115 | views: views)) 116 | superview.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[decButton]-0-|", 117 | options: NSLayoutFormatOptions(rawValue: 0), 118 | metrics: nil, 119 | views: views)) 120 | } 121 | 122 | // MARK - Actions 123 | func onIncButtonTapped(_ sender: AnyObject?) { 124 | updateNumberOfItems(dif: 1) 125 | } 126 | 127 | func onDecButtonTapped(_ sender: AnyObject?) { 128 | updateNumberOfItems(dif: -1) 129 | } 130 | 131 | // MARK - UICollectionViewDataSource 132 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 133 | return self.numberOfItems 134 | } 135 | 136 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 137 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! CollectionViewCellWithLabel 138 | cell.backgroundColor = #colorLiteral(red: 0.4028071761, green: 0.7315050364, blue: 0.2071235478, alpha: 1) 139 | cell.label?.text = "Item #\(indexPath.row)" 140 | return cell 141 | } 142 | } 143 | 144 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/README.md: -------------------------------------------------------------------------------- 1 | **MDBottomSnappingCells**
2 | Special UICollectionView layout that makes cells stick to the bottom if there are not enough cells to fill it vertically. 3 | 4 | ![Example](bottomsnappingcells.gif) 5 | 6 | **Note:** written in Swift 3. 7 | -------------------------------------------------------------------------------- /MDBottomSnappingCells/bottomsnappingcells.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maniak-dobrii/iOS-solutions/b5426c2f153f54371fab45c2f1dc4178d888d9e6/MDBottomSnappingCells/bottomsnappingcells.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | iOS-solutions 2 | ============= 3 | 4 | iOS projects for some solutions I'd like to share or not forget 5 | 6 | 7 | 8 | **TableHeaderView+Autolayout**
9 | Dynamic UITableView header's height based on content using Auto Layout. 10 | 11 | **IBInspectable+AccessibilityIdentifier**
12 | Demonstrates ability to set UIView's accessibilityIdentifier from interface builder via IBInspectable. 13 | 14 | **ICU plural rules**
15 | Demonstrates number plural form determination via [ICU](http://site.icu-project.org/). Apple uses something like that to select correct string from `.stringsdict`. See [Understanding iOS internationalization](http://maniak-dobrii.com/understanding-ios-internationalization/) for details. 16 | 17 | **MDBottomSnappingCells**
18 | Special UICollectionView layout that makes cells stick to the bottom if there are not enough cells to fill it vertically. 19 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6CA56F16185C6F95006017DE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA56F15185C6F95006017DE /* Foundation.framework */; }; 11 | 6CA56F18185C6F95006017DE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA56F17185C6F95006017DE /* CoreGraphics.framework */; }; 12 | 6CA56F1A185C6F95006017DE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA56F19185C6F95006017DE /* UIKit.framework */; }; 13 | 6CA56F20185C6F95006017DE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6CA56F1E185C6F95006017DE /* InfoPlist.strings */; }; 14 | 6CA56F22185C6F95006017DE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CA56F21185C6F95006017DE /* main.m */; }; 15 | 6CA56F26185C6F95006017DE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CA56F25185C6F95006017DE /* AppDelegate.m */; }; 16 | 6CA56F29185C6F95006017DE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CA56F27185C6F95006017DE /* Main.storyboard */; }; 17 | 6CA56F2C185C6F95006017DE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CA56F2B185C6F95006017DE /* ViewController.m */; }; 18 | 6CA56F2E185C6F95006017DE /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6CA56F2D185C6F95006017DE /* Images.xcassets */; }; 19 | 6CA56F35185C6F95006017DE /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA56F34185C6F95006017DE /* XCTest.framework */; }; 20 | 6CA56F36185C6F95006017DE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA56F15185C6F95006017DE /* Foundation.framework */; }; 21 | 6CA56F37185C6F95006017DE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA56F19185C6F95006017DE /* UIKit.framework */; }; 22 | 6CA56F3F185C6F95006017DE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6CA56F3D185C6F95006017DE /* InfoPlist.strings */; }; 23 | 6CA56F41185C6F95006017DE /* TableHeaderView_AutolayoutTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CA56F40185C6F95006017DE /* TableHeaderView_AutolayoutTests.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 6CA56F38185C6F95006017DE /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 6CA56F0A185C6F95006017DE /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 6CA56F11185C6F95006017DE; 32 | remoteInfo = "TableHeaderView+Autolayout"; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 6CA56F12185C6F95006017DE /* TableHeaderView+Autolayout.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TableHeaderView+Autolayout.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 6CA56F15185C6F95006017DE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 39 | 6CA56F17185C6F95006017DE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 40 | 6CA56F19185C6F95006017DE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 41 | 6CA56F1D185C6F95006017DE /* TableHeaderView+Autolayout-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TableHeaderView+Autolayout-Info.plist"; sourceTree = ""; }; 42 | 6CA56F1F185C6F95006017DE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 43 | 6CA56F21185C6F95006017DE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 44 | 6CA56F23185C6F95006017DE /* TableHeaderView+Autolayout-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TableHeaderView+Autolayout-Prefix.pch"; sourceTree = ""; }; 45 | 6CA56F24185C6F95006017DE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 6CA56F25185C6F95006017DE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 6CA56F28185C6F95006017DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 6CA56F2A185C6F95006017DE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 49 | 6CA56F2B185C6F95006017DE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 50 | 6CA56F2D185C6F95006017DE /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 51 | 6CA56F33185C6F95006017DE /* TableHeaderView+AutolayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "TableHeaderView+AutolayoutTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 6CA56F34185C6F95006017DE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 53 | 6CA56F3C185C6F95006017DE /* TableHeaderView+AutolayoutTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TableHeaderView+AutolayoutTests-Info.plist"; sourceTree = ""; }; 54 | 6CA56F3E185C6F95006017DE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 55 | 6CA56F40185C6F95006017DE /* TableHeaderView_AutolayoutTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TableHeaderView_AutolayoutTests.m; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 6CA56F0F185C6F95006017DE /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 6CA56F18185C6F95006017DE /* CoreGraphics.framework in Frameworks */, 64 | 6CA56F1A185C6F95006017DE /* UIKit.framework in Frameworks */, 65 | 6CA56F16185C6F95006017DE /* Foundation.framework in Frameworks */, 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | 6CA56F30185C6F95006017DE /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | 6CA56F35185C6F95006017DE /* XCTest.framework in Frameworks */, 74 | 6CA56F37185C6F95006017DE /* UIKit.framework in Frameworks */, 75 | 6CA56F36185C6F95006017DE /* Foundation.framework in Frameworks */, 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | /* End PBXFrameworksBuildPhase section */ 80 | 81 | /* Begin PBXGroup section */ 82 | 6CA56F09185C6F95006017DE = { 83 | isa = PBXGroup; 84 | children = ( 85 | 6CA56F1B185C6F95006017DE /* TableHeaderView+Autolayout */, 86 | 6CA56F3A185C6F95006017DE /* TableHeaderView+AutolayoutTests */, 87 | 6CA56F14185C6F95006017DE /* Frameworks */, 88 | 6CA56F13185C6F95006017DE /* Products */, 89 | ); 90 | sourceTree = ""; 91 | }; 92 | 6CA56F13185C6F95006017DE /* Products */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 6CA56F12185C6F95006017DE /* TableHeaderView+Autolayout.app */, 96 | 6CA56F33185C6F95006017DE /* TableHeaderView+AutolayoutTests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 6CA56F14185C6F95006017DE /* Frameworks */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 6CA56F15185C6F95006017DE /* Foundation.framework */, 105 | 6CA56F17185C6F95006017DE /* CoreGraphics.framework */, 106 | 6CA56F19185C6F95006017DE /* UIKit.framework */, 107 | 6CA56F34185C6F95006017DE /* XCTest.framework */, 108 | ); 109 | name = Frameworks; 110 | sourceTree = ""; 111 | }; 112 | 6CA56F1B185C6F95006017DE /* TableHeaderView+Autolayout */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 6CA56F24185C6F95006017DE /* AppDelegate.h */, 116 | 6CA56F25185C6F95006017DE /* AppDelegate.m */, 117 | 6CA56F27185C6F95006017DE /* Main.storyboard */, 118 | 6CA56F2A185C6F95006017DE /* ViewController.h */, 119 | 6CA56F2B185C6F95006017DE /* ViewController.m */, 120 | 6CA56F2D185C6F95006017DE /* Images.xcassets */, 121 | 6CA56F1C185C6F95006017DE /* Supporting Files */, 122 | ); 123 | path = "TableHeaderView+Autolayout"; 124 | sourceTree = ""; 125 | }; 126 | 6CA56F1C185C6F95006017DE /* Supporting Files */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 6CA56F1D185C6F95006017DE /* TableHeaderView+Autolayout-Info.plist */, 130 | 6CA56F1E185C6F95006017DE /* InfoPlist.strings */, 131 | 6CA56F21185C6F95006017DE /* main.m */, 132 | 6CA56F23185C6F95006017DE /* TableHeaderView+Autolayout-Prefix.pch */, 133 | ); 134 | name = "Supporting Files"; 135 | sourceTree = ""; 136 | }; 137 | 6CA56F3A185C6F95006017DE /* TableHeaderView+AutolayoutTests */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 6CA56F40185C6F95006017DE /* TableHeaderView_AutolayoutTests.m */, 141 | 6CA56F3B185C6F95006017DE /* Supporting Files */, 142 | ); 143 | path = "TableHeaderView+AutolayoutTests"; 144 | sourceTree = ""; 145 | }; 146 | 6CA56F3B185C6F95006017DE /* Supporting Files */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 6CA56F3C185C6F95006017DE /* TableHeaderView+AutolayoutTests-Info.plist */, 150 | 6CA56F3D185C6F95006017DE /* InfoPlist.strings */, 151 | ); 152 | name = "Supporting Files"; 153 | sourceTree = ""; 154 | }; 155 | /* End PBXGroup section */ 156 | 157 | /* Begin PBXNativeTarget section */ 158 | 6CA56F11185C6F95006017DE /* TableHeaderView+Autolayout */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = 6CA56F44185C6F95006017DE /* Build configuration list for PBXNativeTarget "TableHeaderView+Autolayout" */; 161 | buildPhases = ( 162 | 6CA56F0E185C6F95006017DE /* Sources */, 163 | 6CA56F0F185C6F95006017DE /* Frameworks */, 164 | 6CA56F10185C6F95006017DE /* Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | ); 170 | name = "TableHeaderView+Autolayout"; 171 | productName = "TableHeaderView+Autolayout"; 172 | productReference = 6CA56F12185C6F95006017DE /* TableHeaderView+Autolayout.app */; 173 | productType = "com.apple.product-type.application"; 174 | }; 175 | 6CA56F32185C6F95006017DE /* TableHeaderView+AutolayoutTests */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 6CA56F47185C6F95006017DE /* Build configuration list for PBXNativeTarget "TableHeaderView+AutolayoutTests" */; 178 | buildPhases = ( 179 | 6CA56F2F185C6F95006017DE /* Sources */, 180 | 6CA56F30185C6F95006017DE /* Frameworks */, 181 | 6CA56F31185C6F95006017DE /* Resources */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | 6CA56F39185C6F95006017DE /* PBXTargetDependency */, 187 | ); 188 | name = "TableHeaderView+AutolayoutTests"; 189 | productName = "TableHeaderView+AutolayoutTests"; 190 | productReference = 6CA56F33185C6F95006017DE /* TableHeaderView+AutolayoutTests.xctest */; 191 | productType = "com.apple.product-type.bundle.unit-test"; 192 | }; 193 | /* End PBXNativeTarget section */ 194 | 195 | /* Begin PBXProject section */ 196 | 6CA56F0A185C6F95006017DE /* Project object */ = { 197 | isa = PBXProject; 198 | attributes = { 199 | LastUpgradeCheck = 0500; 200 | ORGANIZATIONNAME = MDC; 201 | TargetAttributes = { 202 | 6CA56F32185C6F95006017DE = { 203 | TestTargetID = 6CA56F11185C6F95006017DE; 204 | }; 205 | }; 206 | }; 207 | buildConfigurationList = 6CA56F0D185C6F95006017DE /* Build configuration list for PBXProject "TableHeaderView+Autolayout" */; 208 | compatibilityVersion = "Xcode 3.2"; 209 | developmentRegion = English; 210 | hasScannedForEncodings = 0; 211 | knownRegions = ( 212 | en, 213 | Base, 214 | ); 215 | mainGroup = 6CA56F09185C6F95006017DE; 216 | productRefGroup = 6CA56F13185C6F95006017DE /* Products */; 217 | projectDirPath = ""; 218 | projectRoot = ""; 219 | targets = ( 220 | 6CA56F11185C6F95006017DE /* TableHeaderView+Autolayout */, 221 | 6CA56F32185C6F95006017DE /* TableHeaderView+AutolayoutTests */, 222 | ); 223 | }; 224 | /* End PBXProject section */ 225 | 226 | /* Begin PBXResourcesBuildPhase section */ 227 | 6CA56F10185C6F95006017DE /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 6CA56F2E185C6F95006017DE /* Images.xcassets in Resources */, 232 | 6CA56F20185C6F95006017DE /* InfoPlist.strings in Resources */, 233 | 6CA56F29185C6F95006017DE /* Main.storyboard in Resources */, 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | }; 237 | 6CA56F31185C6F95006017DE /* Resources */ = { 238 | isa = PBXResourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | 6CA56F3F185C6F95006017DE /* InfoPlist.strings in Resources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXResourcesBuildPhase section */ 246 | 247 | /* Begin PBXSourcesBuildPhase section */ 248 | 6CA56F0E185C6F95006017DE /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | 6CA56F2C185C6F95006017DE /* ViewController.m in Sources */, 253 | 6CA56F26185C6F95006017DE /* AppDelegate.m in Sources */, 254 | 6CA56F22185C6F95006017DE /* main.m in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | 6CA56F2F185C6F95006017DE /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 6CA56F41185C6F95006017DE /* TableHeaderView_AutolayoutTests.m in Sources */, 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | /* End PBXSourcesBuildPhase section */ 267 | 268 | /* Begin PBXTargetDependency section */ 269 | 6CA56F39185C6F95006017DE /* PBXTargetDependency */ = { 270 | isa = PBXTargetDependency; 271 | target = 6CA56F11185C6F95006017DE /* TableHeaderView+Autolayout */; 272 | targetProxy = 6CA56F38185C6F95006017DE /* PBXContainerItemProxy */; 273 | }; 274 | /* End PBXTargetDependency section */ 275 | 276 | /* Begin PBXVariantGroup section */ 277 | 6CA56F1E185C6F95006017DE /* InfoPlist.strings */ = { 278 | isa = PBXVariantGroup; 279 | children = ( 280 | 6CA56F1F185C6F95006017DE /* en */, 281 | ); 282 | name = InfoPlist.strings; 283 | sourceTree = ""; 284 | }; 285 | 6CA56F27185C6F95006017DE /* Main.storyboard */ = { 286 | isa = PBXVariantGroup; 287 | children = ( 288 | 6CA56F28185C6F95006017DE /* Base */, 289 | ); 290 | name = Main.storyboard; 291 | sourceTree = ""; 292 | }; 293 | 6CA56F3D185C6F95006017DE /* InfoPlist.strings */ = { 294 | isa = PBXVariantGroup; 295 | children = ( 296 | 6CA56F3E185C6F95006017DE /* en */, 297 | ); 298 | name = InfoPlist.strings; 299 | sourceTree = ""; 300 | }; 301 | /* End PBXVariantGroup section */ 302 | 303 | /* Begin XCBuildConfiguration section */ 304 | 6CA56F42185C6F95006017DE /* Debug */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ALWAYS_SEARCH_USER_PATHS = NO; 308 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 310 | CLANG_CXX_LIBRARY = "libc++"; 311 | CLANG_ENABLE_MODULES = YES; 312 | CLANG_ENABLE_OBJC_ARC = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INT_CONVERSION = YES; 319 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 321 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 322 | COPY_PHASE_STRIP = NO; 323 | GCC_C_LANGUAGE_STANDARD = gnu99; 324 | GCC_DYNAMIC_NO_PIC = NO; 325 | GCC_OPTIMIZATION_LEVEL = 0; 326 | GCC_PREPROCESSOR_DEFINITIONS = ( 327 | "DEBUG=1", 328 | "$(inherited)", 329 | ); 330 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 331 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 332 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 333 | GCC_WARN_UNDECLARED_SELECTOR = YES; 334 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 335 | GCC_WARN_UNUSED_FUNCTION = YES; 336 | GCC_WARN_UNUSED_VARIABLE = YES; 337 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 338 | ONLY_ACTIVE_ARCH = YES; 339 | SDKROOT = iphoneos; 340 | }; 341 | name = Debug; 342 | }; 343 | 6CA56F43185C6F95006017DE /* Release */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ALWAYS_SEARCH_USER_PATHS = NO; 347 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 348 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 349 | CLANG_CXX_LIBRARY = "libc++"; 350 | CLANG_ENABLE_MODULES = YES; 351 | CLANG_ENABLE_OBJC_ARC = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_CONSTANT_CONVERSION = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = YES; 362 | ENABLE_NS_ASSERTIONS = NO; 363 | GCC_C_LANGUAGE_STANDARD = gnu99; 364 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 365 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 366 | GCC_WARN_UNDECLARED_SELECTOR = YES; 367 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 368 | GCC_WARN_UNUSED_FUNCTION = YES; 369 | GCC_WARN_UNUSED_VARIABLE = YES; 370 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 371 | SDKROOT = iphoneos; 372 | VALIDATE_PRODUCT = YES; 373 | }; 374 | name = Release; 375 | }; 376 | 6CA56F45185C6F95006017DE /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 380 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 381 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 382 | GCC_PREFIX_HEADER = "TableHeaderView+Autolayout/TableHeaderView+Autolayout-Prefix.pch"; 383 | INFOPLIST_FILE = "TableHeaderView+Autolayout/TableHeaderView+Autolayout-Info.plist"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | WRAPPER_EXTENSION = app; 386 | }; 387 | name = Debug; 388 | }; 389 | 6CA56F46185C6F95006017DE /* Release */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 393 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 394 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 395 | GCC_PREFIX_HEADER = "TableHeaderView+Autolayout/TableHeaderView+Autolayout-Prefix.pch"; 396 | INFOPLIST_FILE = "TableHeaderView+Autolayout/TableHeaderView+Autolayout-Info.plist"; 397 | PRODUCT_NAME = "$(TARGET_NAME)"; 398 | WRAPPER_EXTENSION = app; 399 | }; 400 | name = Release; 401 | }; 402 | 6CA56F48185C6F95006017DE /* Debug */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 406 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TableHeaderView+Autolayout.app/TableHeaderView+Autolayout"; 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 = "TableHeaderView+Autolayout/TableHeaderView+Autolayout-Prefix.pch"; 414 | GCC_PREPROCESSOR_DEFINITIONS = ( 415 | "DEBUG=1", 416 | "$(inherited)", 417 | ); 418 | INFOPLIST_FILE = "TableHeaderView+AutolayoutTests/TableHeaderView+AutolayoutTests-Info.plist"; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | TEST_HOST = "$(BUNDLE_LOADER)"; 421 | WRAPPER_EXTENSION = xctest; 422 | }; 423 | name = Debug; 424 | }; 425 | 6CA56F49185C6F95006017DE /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 429 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TableHeaderView+Autolayout.app/TableHeaderView+Autolayout"; 430 | FRAMEWORK_SEARCH_PATHS = ( 431 | "$(SDKROOT)/Developer/Library/Frameworks", 432 | "$(inherited)", 433 | "$(DEVELOPER_FRAMEWORKS_DIR)", 434 | ); 435 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 436 | GCC_PREFIX_HEADER = "TableHeaderView+Autolayout/TableHeaderView+Autolayout-Prefix.pch"; 437 | INFOPLIST_FILE = "TableHeaderView+AutolayoutTests/TableHeaderView+AutolayoutTests-Info.plist"; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | TEST_HOST = "$(BUNDLE_LOADER)"; 440 | WRAPPER_EXTENSION = xctest; 441 | }; 442 | name = Release; 443 | }; 444 | /* End XCBuildConfiguration section */ 445 | 446 | /* Begin XCConfigurationList section */ 447 | 6CA56F0D185C6F95006017DE /* Build configuration list for PBXProject "TableHeaderView+Autolayout" */ = { 448 | isa = XCConfigurationList; 449 | buildConfigurations = ( 450 | 6CA56F42185C6F95006017DE /* Debug */, 451 | 6CA56F43185C6F95006017DE /* Release */, 452 | ); 453 | defaultConfigurationIsVisible = 0; 454 | defaultConfigurationName = Release; 455 | }; 456 | 6CA56F44185C6F95006017DE /* Build configuration list for PBXNativeTarget "TableHeaderView+Autolayout" */ = { 457 | isa = XCConfigurationList; 458 | buildConfigurations = ( 459 | 6CA56F45185C6F95006017DE /* Debug */, 460 | 6CA56F46185C6F95006017DE /* Release */, 461 | ); 462 | defaultConfigurationIsVisible = 0; 463 | }; 464 | 6CA56F47185C6F95006017DE /* Build configuration list for PBXNativeTarget "TableHeaderView+AutolayoutTests" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | 6CA56F48185C6F95006017DE /* Debug */, 468 | 6CA56F49185C6F95006017DE /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | }; 472 | /* End XCConfigurationList section */ 473 | }; 474 | rootObject = 6CA56F0A185C6F95006017DE /* Project object */; 475 | } 476 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TableHeaderView+Autolayout 4 | // 5 | // Created by MD on 12/14/13. 6 | // Copyright (c) 2013 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TableHeaderView+Autolayout 4 | // 5 | // Created by MD on 12/14/13. 6 | // Copyright (c) 2013 MDC. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 36 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/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 | } -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/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 | } -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/TableHeaderView+Autolayout-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.MDC.${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 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/TableHeaderView+Autolayout-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 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // TableHeaderView+Autolayout 4 | // 5 | // Created by MD on 12/14/13. 6 | // Copyright (c) 2013 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | @property (nonatomic, strong) IBOutlet UITableView* tableView; 13 | @property (nonatomic, strong) IBOutlet UIView* tableHeaderViewWrapper; 14 | 15 | @property (nonatomic, strong) IBOutlet UILabel* headerLabel; 16 | @end 17 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // TableHeaderView+Autolayout 4 | // 5 | // Created by MD on 12/14/13. 6 | // Copyright (c) 2013 MDC. All rights reserved. 7 | // 8 | 9 | 10 | 11 | /* 12 | 1) Add a headerView to a UITableView. 13 | 2) Add a subview to headerView, let's call it wrapper. 14 | 3) Make wrapper's height be adjusted with it's subviews (via Auto Layout). 15 | 4) When autolayout had finished layout, set headerView's height to wrapper's height. (see -updateTableViewHeaderViewHeight) 16 | 5) Reset headerView. (see -resetTableViewHeaderView) 17 | 18 | 19 | All this works seamlessly after the initial autolayout pass. Later, if you change wrapper's contents so that it gains different 20 | height, it wont work for some reason (guess laying out UILabel requires several autolayout passes or something). I solved this 21 | with scheduling setNeedsLayout for the ViewController's view in the next run loop iteration. 22 | */ 23 | 24 | 25 | 26 | #import "ViewController.h" 27 | 28 | @interface ViewController () 29 | 30 | @end 31 | 32 | @implementation ViewController 33 | 34 | #pragma mark Important stuff 35 | 36 | - (void)viewDidLayoutSubviews 37 | { 38 | [super viewDidLayoutSubviews]; 39 | 40 | [self updateTableViewHeaderViewHeight]; 41 | } 42 | 43 | /** 44 | tableView's tableViewHeaderView contains wrapper view, which height is evaluated 45 | with Auto Layout. Here I use evaluated height and update tableView's tableViewHeaderView's frame. 46 | 47 | New height for tableViewHeaderView doesn't applies without magic, that's why I call -resetTableViewHeaderView. 48 | And again, this doesn't work due to some internals of UITableView, so -resetTableViewHeaderView call is scheduled 49 | in the main run loop just after it's the last iteration finishes. 50 | */ 51 | - (void)updateTableViewHeaderViewHeight 52 | { 53 | // get height of the wrapper and apply it to a header 54 | CGRect Frame = self.tableView.tableHeaderView.frame; 55 | Frame.size.height = self.tableHeaderViewWrapper.frame.size.height; 56 | self.tableView.tableHeaderView.frame = Frame; 57 | 58 | // this magic applies the above changes 59 | // note, that if you won't schedule this call to the next run loop iteration 60 | // you'll get and error 61 | [self performSelector:@selector(resetTableViewHeaderView) withObject:self afterDelay:0]; 62 | } 63 | 64 | // yeah, gues there's something special in the setter 65 | - (void)resetTableViewHeaderView 66 | { 67 | // whew, this could be animated! 68 | [UIView beginAnimations:@"tableHeaderView" context:nil]; 69 | 70 | self.tableView.tableHeaderView = self.tableView.tableHeaderView; 71 | 72 | [UIView commitAnimations]; 73 | } 74 | 75 | 76 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 77 | { 78 | if(indexPath.row == 0) 79 | { 80 | self.headerLabel.text = @"waka!"; 81 | } 82 | else 83 | { 84 | self.headerLabel.text = @"Dynamic text label, sooo long, that it wraps to the next line, just to show that it could have different height."; 85 | } 86 | 87 | // We need this to update the height, still not fully sure why do we need to 88 | // schedule this call for the next Run Loop iteration, will appreciate comments. 89 | [self.view performSelector:@selector(setNeedsLayout) withObject:nil afterDelay:0]; 90 | } 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | #pragma mark - 101 | // some not interesting UITableView stuff 102 | #pragma mark UITableView stuff 103 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 104 | { 105 | return 2; 106 | } 107 | 108 | - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 109 | { 110 | UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class]) forIndexPath:indexPath]; 111 | 112 | if(indexPath.row == 0) 113 | { 114 | cell.textLabel.text = @"Make text Short"; 115 | } 116 | else 117 | { 118 | cell.textLabel.text = @"Make text Long"; 119 | } 120 | 121 | 122 | return cell; 123 | } 124 | 125 | 126 | 127 | // some init stuff, which is just a boilerplate 128 | #pragma mark Common init stuff 129 | - (void)viewDidLoad 130 | { 131 | [super viewDidLoad]; 132 | 133 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])]; 134 | } 135 | 136 | - (void)didReceiveMemoryWarning 137 | { 138 | [super didReceiveMemoryWarning]; 139 | // Dispose of any resources that can be recreated. 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+Autolayout/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TableHeaderView+Autolayout 4 | // 5 | // Created by MD on 12/14/13. 6 | // Copyright (c) 2013 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+AutolayoutTests/TableHeaderView+AutolayoutTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.MDC.${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 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+AutolayoutTests/TableHeaderView_AutolayoutTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableHeaderView_AutolayoutTests.m 3 | // TableHeaderView+AutolayoutTests 4 | // 5 | // Created by MD on 12/14/13. 6 | // Copyright (c) 2013 MDC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableHeaderView_AutolayoutTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation TableHeaderView_AutolayoutTests 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 | -------------------------------------------------------------------------------- /TableHeaderView+Autolayout/TableHeaderView+AutolayoutTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------