├── CollectionViewAnimations.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── enginkurutepe.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── enginkurutepe.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── CollectionViewAnimations.xcscheme │ └── xcschememanagement.plist ├── CollectionViewAnimations ├── CollectionViewAnimations-Info.plist ├── CollectionViewAnimations-Prefix.pch ├── FJAppDelegate.h ├── FJAppDelegate.m ├── FJCollectionViewController.h ├── FJCollectionViewController.m ├── FJDetailViewController.h ├── FJDetailViewController.m ├── FJFlowLayoutWithAnimations.h ├── FJFlowLayoutWithAnimations.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Storyboard.storyboard ├── en.lproj │ └── InfoPlist.strings └── main.m ├── CollectionViewAnimationsTests ├── CollectionViewAnimationsTests-Info.plist ├── CollectionViewAnimationsTests.m └── en.lproj │ └── InfoPlist.strings └── README.md /CollectionViewAnimations.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 512D63DE190511C000296EE8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 512D63DD190511C000296EE8 /* Foundation.framework */; }; 11 | 512D63E0190511C000296EE8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 512D63DF190511C000296EE8 /* CoreGraphics.framework */; }; 12 | 512D63E2190511C000296EE8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 512D63E1190511C000296EE8 /* UIKit.framework */; }; 13 | 512D63E8190511C000296EE8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 512D63E6190511C000296EE8 /* InfoPlist.strings */; }; 14 | 512D63EA190511C000296EE8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 512D63E9190511C000296EE8 /* main.m */; }; 15 | 512D63EE190511C000296EE8 /* FJAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 512D63ED190511C000296EE8 /* FJAppDelegate.m */; }; 16 | 512D63F0190511C000296EE8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 512D63EF190511C000296EE8 /* Images.xcassets */; }; 17 | 512D63F7190511C000296EE8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 512D63F6190511C000296EE8 /* XCTest.framework */; }; 18 | 512D63F8190511C000296EE8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 512D63DD190511C000296EE8 /* Foundation.framework */; }; 19 | 512D63F9190511C000296EE8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 512D63E1190511C000296EE8 /* UIKit.framework */; }; 20 | 512D6401190511C000296EE8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 512D63FF190511C000296EE8 /* InfoPlist.strings */; }; 21 | 512D6403190511C000296EE8 /* CollectionViewAnimationsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 512D6402190511C000296EE8 /* CollectionViewAnimationsTests.m */; }; 22 | 512D640E190511E600296EE8 /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 512D640D190511E600296EE8 /* Storyboard.storyboard */; }; 23 | 512D64111905124900296EE8 /* FJCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 512D64101905124900296EE8 /* FJCollectionViewController.m */; }; 24 | 512D6418190BE4FC00296EE8 /* FJFlowLayoutWithAnimations.m in Sources */ = {isa = PBXBuildFile; fileRef = 512D6417190BE4FC00296EE8 /* FJFlowLayoutWithAnimations.m */; }; 25 | 512D641B190D08FA00296EE8 /* FJDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 512D641A190D08FA00296EE8 /* FJDetailViewController.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 512D63FA190511C000296EE8 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 512D63D2190511C000296EE8 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 512D63D9190511C000296EE8; 34 | remoteInfo = CollectionViewAnimations; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 512D63DA190511C000296EE8 /* CollectionViewAnimations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CollectionViewAnimations.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 512D63DD190511C000296EE8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | 512D63DF190511C000296EE8 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | 512D63E1190511C000296EE8 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 512D63E5190511C000296EE8 /* CollectionViewAnimations-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CollectionViewAnimations-Info.plist"; sourceTree = ""; }; 44 | 512D63E7190511C000296EE8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | 512D63E9190511C000296EE8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 512D63EB190511C000296EE8 /* CollectionViewAnimations-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CollectionViewAnimations-Prefix.pch"; sourceTree = ""; }; 47 | 512D63EC190511C000296EE8 /* FJAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FJAppDelegate.h; sourceTree = ""; }; 48 | 512D63ED190511C000296EE8 /* FJAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FJAppDelegate.m; sourceTree = ""; }; 49 | 512D63EF190511C000296EE8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 50 | 512D63F5190511C000296EE8 /* CollectionViewAnimationsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CollectionViewAnimationsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 512D63F6190511C000296EE8 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 52 | 512D63FE190511C000296EE8 /* CollectionViewAnimationsTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CollectionViewAnimationsTests-Info.plist"; sourceTree = ""; }; 53 | 512D6400190511C000296EE8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 54 | 512D6402190511C000296EE8 /* CollectionViewAnimationsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CollectionViewAnimationsTests.m; sourceTree = ""; }; 55 | 512D640D190511E600296EE8 /* Storyboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = ""; }; 56 | 512D640F1905124900296EE8 /* FJCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FJCollectionViewController.h; sourceTree = ""; }; 57 | 512D64101905124900296EE8 /* FJCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FJCollectionViewController.m; sourceTree = ""; }; 58 | 512D6416190BE4FC00296EE8 /* FJFlowLayoutWithAnimations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FJFlowLayoutWithAnimations.h; sourceTree = ""; }; 59 | 512D6417190BE4FC00296EE8 /* FJFlowLayoutWithAnimations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FJFlowLayoutWithAnimations.m; sourceTree = ""; }; 60 | 512D6419190D08FA00296EE8 /* FJDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FJDetailViewController.h; sourceTree = ""; }; 61 | 512D641A190D08FA00296EE8 /* FJDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FJDetailViewController.m; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 512D63D7190511C000296EE8 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | 512D63E0190511C000296EE8 /* CoreGraphics.framework in Frameworks */, 70 | 512D63E2190511C000296EE8 /* UIKit.framework in Frameworks */, 71 | 512D63DE190511C000296EE8 /* Foundation.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 512D63F2190511C000296EE8 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 512D63F7190511C000296EE8 /* XCTest.framework in Frameworks */, 80 | 512D63F9190511C000296EE8 /* UIKit.framework in Frameworks */, 81 | 512D63F8190511C000296EE8 /* Foundation.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 512D63D1190511C000296EE8 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 512D63E3190511C000296EE8 /* CollectionViewAnimations */, 92 | 512D63FC190511C000296EE8 /* CollectionViewAnimationsTests */, 93 | 512D63DC190511C000296EE8 /* Frameworks */, 94 | 512D63DB190511C000296EE8 /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 512D63DB190511C000296EE8 /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 512D63DA190511C000296EE8 /* CollectionViewAnimations.app */, 102 | 512D63F5190511C000296EE8 /* CollectionViewAnimationsTests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 512D63DC190511C000296EE8 /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 512D63DD190511C000296EE8 /* Foundation.framework */, 111 | 512D63DF190511C000296EE8 /* CoreGraphics.framework */, 112 | 512D63E1190511C000296EE8 /* UIKit.framework */, 113 | 512D63F6190511C000296EE8 /* XCTest.framework */, 114 | ); 115 | name = Frameworks; 116 | sourceTree = ""; 117 | }; 118 | 512D63E3190511C000296EE8 /* CollectionViewAnimations */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 512D6415190BE4DC00296EE8 /* Layouts */, 122 | 512D640C190511CE00296EE8 /* Controllers */, 123 | 512D63EC190511C000296EE8 /* FJAppDelegate.h */, 124 | 512D63ED190511C000296EE8 /* FJAppDelegate.m */, 125 | 512D63EF190511C000296EE8 /* Images.xcassets */, 126 | 512D63E4190511C000296EE8 /* Supporting Files */, 127 | ); 128 | path = CollectionViewAnimations; 129 | sourceTree = ""; 130 | }; 131 | 512D63E4190511C000296EE8 /* Supporting Files */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 512D63E5190511C000296EE8 /* CollectionViewAnimations-Info.plist */, 135 | 512D63E6190511C000296EE8 /* InfoPlist.strings */, 136 | 512D63E9190511C000296EE8 /* main.m */, 137 | 512D63EB190511C000296EE8 /* CollectionViewAnimations-Prefix.pch */, 138 | ); 139 | name = "Supporting Files"; 140 | sourceTree = ""; 141 | }; 142 | 512D63FC190511C000296EE8 /* CollectionViewAnimationsTests */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 512D6402190511C000296EE8 /* CollectionViewAnimationsTests.m */, 146 | 512D63FD190511C000296EE8 /* Supporting Files */, 147 | ); 148 | path = CollectionViewAnimationsTests; 149 | sourceTree = ""; 150 | }; 151 | 512D63FD190511C000296EE8 /* Supporting Files */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 512D63FE190511C000296EE8 /* CollectionViewAnimationsTests-Info.plist */, 155 | 512D63FF190511C000296EE8 /* InfoPlist.strings */, 156 | ); 157 | name = "Supporting Files"; 158 | sourceTree = ""; 159 | }; 160 | 512D640C190511CE00296EE8 /* Controllers */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | 512D640D190511E600296EE8 /* Storyboard.storyboard */, 164 | 512D640F1905124900296EE8 /* FJCollectionViewController.h */, 165 | 512D64101905124900296EE8 /* FJCollectionViewController.m */, 166 | 512D6419190D08FA00296EE8 /* FJDetailViewController.h */, 167 | 512D641A190D08FA00296EE8 /* FJDetailViewController.m */, 168 | ); 169 | name = Controllers; 170 | sourceTree = ""; 171 | }; 172 | 512D6415190BE4DC00296EE8 /* Layouts */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | 512D6416190BE4FC00296EE8 /* FJFlowLayoutWithAnimations.h */, 176 | 512D6417190BE4FC00296EE8 /* FJFlowLayoutWithAnimations.m */, 177 | ); 178 | name = Layouts; 179 | sourceTree = ""; 180 | }; 181 | /* End PBXGroup section */ 182 | 183 | /* Begin PBXNativeTarget section */ 184 | 512D63D9190511C000296EE8 /* CollectionViewAnimations */ = { 185 | isa = PBXNativeTarget; 186 | buildConfigurationList = 512D6406190511C000296EE8 /* Build configuration list for PBXNativeTarget "CollectionViewAnimations" */; 187 | buildPhases = ( 188 | 512D63D6190511C000296EE8 /* Sources */, 189 | 512D63D7190511C000296EE8 /* Frameworks */, 190 | 512D63D8190511C000296EE8 /* Resources */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | ); 196 | name = CollectionViewAnimations; 197 | productName = CollectionViewAnimations; 198 | productReference = 512D63DA190511C000296EE8 /* CollectionViewAnimations.app */; 199 | productType = "com.apple.product-type.application"; 200 | }; 201 | 512D63F4190511C000296EE8 /* CollectionViewAnimationsTests */ = { 202 | isa = PBXNativeTarget; 203 | buildConfigurationList = 512D6409190511C000296EE8 /* Build configuration list for PBXNativeTarget "CollectionViewAnimationsTests" */; 204 | buildPhases = ( 205 | 512D63F1190511C000296EE8 /* Sources */, 206 | 512D63F2190511C000296EE8 /* Frameworks */, 207 | 512D63F3190511C000296EE8 /* Resources */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | 512D63FB190511C000296EE8 /* PBXTargetDependency */, 213 | ); 214 | name = CollectionViewAnimationsTests; 215 | productName = CollectionViewAnimationsTests; 216 | productReference = 512D63F5190511C000296EE8 /* CollectionViewAnimationsTests.xctest */; 217 | productType = "com.apple.product-type.bundle.unit-test"; 218 | }; 219 | /* End PBXNativeTarget section */ 220 | 221 | /* Begin PBXProject section */ 222 | 512D63D2190511C000296EE8 /* Project object */ = { 223 | isa = PBXProject; 224 | attributes = { 225 | CLASSPREFIX = FJ; 226 | LastUpgradeCheck = 0510; 227 | ORGANIZATIONNAME = "Fifteen Jugglers Software"; 228 | TargetAttributes = { 229 | 512D63F4190511C000296EE8 = { 230 | TestTargetID = 512D63D9190511C000296EE8; 231 | }; 232 | }; 233 | }; 234 | buildConfigurationList = 512D63D5190511C000296EE8 /* Build configuration list for PBXProject "CollectionViewAnimations" */; 235 | compatibilityVersion = "Xcode 3.2"; 236 | developmentRegion = English; 237 | hasScannedForEncodings = 0; 238 | knownRegions = ( 239 | en, 240 | ); 241 | mainGroup = 512D63D1190511C000296EE8; 242 | productRefGroup = 512D63DB190511C000296EE8 /* Products */; 243 | projectDirPath = ""; 244 | projectRoot = ""; 245 | targets = ( 246 | 512D63D9190511C000296EE8 /* CollectionViewAnimations */, 247 | 512D63F4190511C000296EE8 /* CollectionViewAnimationsTests */, 248 | ); 249 | }; 250 | /* End PBXProject section */ 251 | 252 | /* Begin PBXResourcesBuildPhase section */ 253 | 512D63D8190511C000296EE8 /* Resources */ = { 254 | isa = PBXResourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | 512D63E8190511C000296EE8 /* InfoPlist.strings in Resources */, 258 | 512D63F0190511C000296EE8 /* Images.xcassets in Resources */, 259 | 512D640E190511E600296EE8 /* Storyboard.storyboard in Resources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | 512D63F3190511C000296EE8 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 512D6401190511C000296EE8 /* InfoPlist.strings in Resources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXResourcesBuildPhase section */ 272 | 273 | /* Begin PBXSourcesBuildPhase section */ 274 | 512D63D6190511C000296EE8 /* Sources */ = { 275 | isa = PBXSourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | 512D64111905124900296EE8 /* FJCollectionViewController.m in Sources */, 279 | 512D63EE190511C000296EE8 /* FJAppDelegate.m in Sources */, 280 | 512D641B190D08FA00296EE8 /* FJDetailViewController.m in Sources */, 281 | 512D6418190BE4FC00296EE8 /* FJFlowLayoutWithAnimations.m in Sources */, 282 | 512D63EA190511C000296EE8 /* main.m in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | 512D63F1190511C000296EE8 /* Sources */ = { 287 | isa = PBXSourcesBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | 512D6403190511C000296EE8 /* CollectionViewAnimationsTests.m in Sources */, 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXSourcesBuildPhase section */ 295 | 296 | /* Begin PBXTargetDependency section */ 297 | 512D63FB190511C000296EE8 /* PBXTargetDependency */ = { 298 | isa = PBXTargetDependency; 299 | target = 512D63D9190511C000296EE8 /* CollectionViewAnimations */; 300 | targetProxy = 512D63FA190511C000296EE8 /* PBXContainerItemProxy */; 301 | }; 302 | /* End PBXTargetDependency section */ 303 | 304 | /* Begin PBXVariantGroup section */ 305 | 512D63E6190511C000296EE8 /* InfoPlist.strings */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 512D63E7190511C000296EE8 /* en */, 309 | ); 310 | name = InfoPlist.strings; 311 | sourceTree = ""; 312 | }; 313 | 512D63FF190511C000296EE8 /* InfoPlist.strings */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 512D6400190511C000296EE8 /* en */, 317 | ); 318 | name = InfoPlist.strings; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXVariantGroup section */ 322 | 323 | /* Begin XCBuildConfiguration section */ 324 | 512D6404190511C000296EE8 /* Debug */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 341 | COPY_PHASE_STRIP = NO; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_DYNAMIC_NO_PIC = NO; 344 | GCC_OPTIMIZATION_LEVEL = 0; 345 | GCC_PREPROCESSOR_DEFINITIONS = ( 346 | "DEBUG=1", 347 | "$(inherited)", 348 | ); 349 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 352 | GCC_WARN_UNDECLARED_SELECTOR = YES; 353 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 354 | GCC_WARN_UNUSED_FUNCTION = YES; 355 | GCC_WARN_UNUSED_VARIABLE = YES; 356 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 357 | ONLY_ACTIVE_ARCH = YES; 358 | SDKROOT = iphoneos; 359 | TARGETED_DEVICE_FAMILY = 2; 360 | }; 361 | name = Debug; 362 | }; 363 | 512D6405190511C000296EE8 /* Release */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 368 | CLANG_CXX_LIBRARY = "libc++"; 369 | CLANG_ENABLE_MODULES = YES; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 374 | CLANG_WARN_EMPTY_BODY = YES; 375 | CLANG_WARN_ENUM_CONVERSION = YES; 376 | CLANG_WARN_INT_CONVERSION = YES; 377 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 378 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 379 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 380 | COPY_PHASE_STRIP = YES; 381 | ENABLE_NS_ASSERTIONS = NO; 382 | GCC_C_LANGUAGE_STANDARD = gnu99; 383 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 384 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 385 | GCC_WARN_UNDECLARED_SELECTOR = YES; 386 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 387 | GCC_WARN_UNUSED_FUNCTION = YES; 388 | GCC_WARN_UNUSED_VARIABLE = YES; 389 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 390 | SDKROOT = iphoneos; 391 | TARGETED_DEVICE_FAMILY = 2; 392 | VALIDATE_PRODUCT = YES; 393 | }; 394 | name = Release; 395 | }; 396 | 512D6407190511C000296EE8 /* Debug */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 400 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 401 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 402 | GCC_PREFIX_HEADER = "CollectionViewAnimations/CollectionViewAnimations-Prefix.pch"; 403 | INFOPLIST_FILE = "CollectionViewAnimations/CollectionViewAnimations-Info.plist"; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | WRAPPER_EXTENSION = app; 406 | }; 407 | name = Debug; 408 | }; 409 | 512D6408190511C000296EE8 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 414 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 415 | GCC_PREFIX_HEADER = "CollectionViewAnimations/CollectionViewAnimations-Prefix.pch"; 416 | INFOPLIST_FILE = "CollectionViewAnimations/CollectionViewAnimations-Info.plist"; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | WRAPPER_EXTENSION = app; 419 | }; 420 | name = Release; 421 | }; 422 | 512D640A190511C000296EE8 /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CollectionViewAnimations.app/CollectionViewAnimations"; 426 | FRAMEWORK_SEARCH_PATHS = ( 427 | "$(SDKROOT)/Developer/Library/Frameworks", 428 | "$(inherited)", 429 | "$(DEVELOPER_FRAMEWORKS_DIR)", 430 | ); 431 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 432 | GCC_PREFIX_HEADER = "CollectionViewAnimations/CollectionViewAnimations-Prefix.pch"; 433 | GCC_PREPROCESSOR_DEFINITIONS = ( 434 | "DEBUG=1", 435 | "$(inherited)", 436 | ); 437 | INFOPLIST_FILE = "CollectionViewAnimationsTests/CollectionViewAnimationsTests-Info.plist"; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | TEST_HOST = "$(BUNDLE_LOADER)"; 440 | WRAPPER_EXTENSION = xctest; 441 | }; 442 | name = Debug; 443 | }; 444 | 512D640B190511C000296EE8 /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CollectionViewAnimations.app/CollectionViewAnimations"; 448 | FRAMEWORK_SEARCH_PATHS = ( 449 | "$(SDKROOT)/Developer/Library/Frameworks", 450 | "$(inherited)", 451 | "$(DEVELOPER_FRAMEWORKS_DIR)", 452 | ); 453 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 454 | GCC_PREFIX_HEADER = "CollectionViewAnimations/CollectionViewAnimations-Prefix.pch"; 455 | INFOPLIST_FILE = "CollectionViewAnimationsTests/CollectionViewAnimationsTests-Info.plist"; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | TEST_HOST = "$(BUNDLE_LOADER)"; 458 | WRAPPER_EXTENSION = xctest; 459 | }; 460 | name = Release; 461 | }; 462 | /* End XCBuildConfiguration section */ 463 | 464 | /* Begin XCConfigurationList section */ 465 | 512D63D5190511C000296EE8 /* Build configuration list for PBXProject "CollectionViewAnimations" */ = { 466 | isa = XCConfigurationList; 467 | buildConfigurations = ( 468 | 512D6404190511C000296EE8 /* Debug */, 469 | 512D6405190511C000296EE8 /* Release */, 470 | ); 471 | defaultConfigurationIsVisible = 0; 472 | defaultConfigurationName = Release; 473 | }; 474 | 512D6406190511C000296EE8 /* Build configuration list for PBXNativeTarget "CollectionViewAnimations" */ = { 475 | isa = XCConfigurationList; 476 | buildConfigurations = ( 477 | 512D6407190511C000296EE8 /* Debug */, 478 | 512D6408190511C000296EE8 /* Release */, 479 | ); 480 | defaultConfigurationIsVisible = 0; 481 | defaultConfigurationName = Release; 482 | }; 483 | 512D6409190511C000296EE8 /* Build configuration list for PBXNativeTarget "CollectionViewAnimationsTests" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 512D640A190511C000296EE8 /* Debug */, 487 | 512D640B190511C000296EE8 /* Release */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | /* End XCConfigurationList section */ 493 | }; 494 | rootObject = 512D63D2190511C000296EE8 /* Project object */; 495 | } 496 | -------------------------------------------------------------------------------- /CollectionViewAnimations.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CollectionViewAnimations.xcodeproj/project.xcworkspace/xcuserdata/enginkurutepe.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objcio/issue-12-CollectionViewAnimations/5d8cf17811072fc3ff834578885a6dc43ad14edd/CollectionViewAnimations.xcodeproj/project.xcworkspace/xcuserdata/enginkurutepe.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CollectionViewAnimations.xcodeproj/project.xcworkspace/xcuserdata/enginkurutepe.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CollectionViewAnimations.xcodeproj/xcuserdata/enginkurutepe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 88 | 100 | 101 | 102 | 104 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /CollectionViewAnimations.xcodeproj/xcuserdata/enginkurutepe.xcuserdatad/xcschemes/CollectionViewAnimations.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CollectionViewAnimations.xcodeproj/xcuserdata/enginkurutepe.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CollectionViewAnimations.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 512D63D9190511C000296EE8 16 | 17 | primary 18 | 19 | 20 | 512D63F4190511C000296EE8 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CollectionViewAnimations/CollectionViewAnimations-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.fifteenjugglers.${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~ipad 28 | Storyboard 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CollectionViewAnimations/CollectionViewAnimations-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // FJAppDelegate.h 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 21/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FJAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // FJAppDelegate.m 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 21/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import "FJAppDelegate.h" 10 | 11 | @implementation FJAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | 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 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJCollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FJCollectionViewController.h 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 21/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FJCollectionViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJCollectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FJCollectionViewController.m 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 21/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import "FJCollectionViewController.h" 10 | #import "FJFlowLayoutWithAnimations.h" 11 | #import "FJDetailViewController.h" 12 | 13 | @interface FJCollectionViewController () 14 | 15 | @property (nonatomic) NSInteger sectionCount; 16 | @property (nonatomic, strong) NSMutableArray *itemCounts; 17 | @property (nonatomic) BOOL largeItems; 18 | @property (nonatomic, strong) FJFlowLayoutWithAnimations *smallLayout; 19 | @property (nonatomic, strong) FJFlowLayoutWithAnimations *largeLayout; 20 | @property (nonatomic) NSInteger selectedItem; 21 | 22 | @property (nonatomic, strong) UIPinchGestureRecognizer *pincher; 23 | @end 24 | 25 | @implementation FJCollectionViewController 26 | 27 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 28 | { 29 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 30 | if (self) { 31 | 32 | } 33 | return self; 34 | } 35 | 36 | - (void)viewDidLoad 37 | { 38 | [super viewDidLoad]; 39 | // Do any additional setup after loading the view. 40 | self.sectionCount = 3; 41 | self.itemCounts = [NSMutableArray arrayWithArray:@[@(13), @(16), @(14)]]; 42 | 43 | self.smallLayout = [[FJFlowLayoutWithAnimations alloc] init]; 44 | _smallLayout.itemSize = CGSizeMake(50, 50); 45 | 46 | self.largeLayout = [[FJFlowLayoutWithAnimations alloc] init]; 47 | _largeLayout.itemSize = CGSizeMake(200, 200); 48 | 49 | self.largeItems = NO; 50 | self.collectionView.collectionViewLayout = _smallLayout; 51 | 52 | UIBarButtonItem *insertItem = [[UIBarButtonItem alloc] 53 | initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 54 | target:self 55 | action:@selector(insertItem)]; 56 | 57 | UIBarButtonItem *deleteItem = [[UIBarButtonItem alloc] 58 | initWithBarButtonSystemItem:UIBarButtonSystemItemTrash 59 | target:self 60 | action:@selector(deleteItem)]; 61 | 62 | UIBarButtonItem *toggleSizeItem = [[UIBarButtonItem alloc] 63 | initWithBarButtonSystemItem:UIBarButtonSystemItemSearch 64 | target:self 65 | action:@selector(toggleItemSize)]; 66 | 67 | self.navigationItem.rightBarButtonItems = @[toggleSizeItem, insertItem, deleteItem]; 68 | 69 | self.pincher = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)]; 70 | 71 | [self.collectionView addGestureRecognizer:_pincher]; 72 | 73 | } 74 | 75 | - (void)handlePinch:(UIPinchGestureRecognizer *)sender { 76 | if ([sender numberOfTouches] != 2) 77 | return; 78 | 79 | 80 | if (sender.state == UIGestureRecognizerStateBegan || 81 | sender.state == UIGestureRecognizerStateChanged) { 82 | // Get the pinch points. 83 | CGPoint p1 = [sender locationOfTouch:0 inView:[self collectionView]]; 84 | CGPoint p2 = [sender locationOfTouch:1 inView:[self collectionView]]; 85 | 86 | // Compute the new spread distance. 87 | CGFloat xd = p1.x - p2.x; 88 | CGFloat yd = p1.y - p2.y; 89 | CGFloat distance = sqrt(xd*xd + yd*yd); 90 | 91 | // Update the custom layout parameter and invalidate. 92 | FJFlowLayoutWithAnimations* layout = (FJFlowLayoutWithAnimations*)[[self collectionView] collectionViewLayout]; 93 | 94 | NSIndexPath *pinchedItem = [self.collectionView indexPathForItemAtPoint:CGPointMake(0.5*(p1.x+p2.x), 0.5*(p1.y+p2.y))]; 95 | [layout resizeItemAtIndexPath:pinchedItem withPinchDistance:distance]; 96 | [layout invalidateLayout]; 97 | 98 | } 99 | else if (sender.state == UIGestureRecognizerStateCancelled || 100 | sender.state == UIGestureRecognizerStateEnded){ 101 | FJFlowLayoutWithAnimations* layout = (FJFlowLayoutWithAnimations*)[[self collectionView] collectionViewLayout]; 102 | [self.collectionView 103 | performBatchUpdates:^{ 104 | [layout resetPinchedItem]; 105 | } 106 | completion:nil]; 107 | } 108 | } 109 | 110 | - (void)viewWillAppear:(BOOL)animated 111 | { 112 | [super viewWillAppear:animated]; 113 | self.navigationController.delegate = self; 114 | } 115 | 116 | - (void)didReceiveMemoryWarning 117 | { 118 | [super didReceiveMemoryWarning]; 119 | // Dispose of any resources that can be recreated. 120 | } 121 | 122 | - (void)insertItem 123 | { 124 | NSInteger randomSection = arc4random_uniform(_sectionCount); 125 | 126 | NSInteger item = [_itemCounts[randomSection] integerValue] + 1; 127 | _itemCounts[randomSection] = @(item); 128 | 129 | [self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:arc4random_uniform(item) inSection:randomSection]]]; 130 | } 131 | 132 | - (void)deleteItem 133 | { 134 | NSInteger randomSection = arc4random_uniform(_sectionCount); 135 | NSInteger item = [_itemCounts[randomSection] integerValue]; 136 | 137 | if (item) { 138 | _itemCounts[randomSection] = @(item-1); 139 | [self.collectionView deleteItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:arc4random_uniform(item) inSection:randomSection]]]; 140 | } 141 | else { 142 | NSInteger totalItems = 0; 143 | for (NSNumber *num in _itemCounts) { 144 | totalItems += [num integerValue]; 145 | } 146 | if (totalItems) { 147 | [self deleteItem]; 148 | } 149 | 150 | } 151 | 152 | } 153 | 154 | - (void)toggleItemSize 155 | { 156 | 157 | if (_largeItems) { 158 | _largeItems = NO; 159 | [self.collectionView setCollectionViewLayout:_smallLayout animated:YES]; 160 | } 161 | else { 162 | [self.collectionView setCollectionViewLayout:_largeLayout animated:YES]; 163 | _largeItems = YES; 164 | } 165 | 166 | 167 | } 168 | 169 | 170 | #pragma mark - Navigation 171 | 172 | // In a storyboard-based application, you will often want to do a little preparation before navigation 173 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 174 | { 175 | // Get the new view controller using [segue destinationViewController]. 176 | // Pass the selected object to the new view controller. 177 | NSIndexPath *indexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; 178 | 179 | if (indexPath) { 180 | FJDetailViewController *dvc = segue.destinationViewController; 181 | dvc.useLayoutToLayoutNavigationTransitions = YES; 182 | 183 | dvc.itemCount = [_itemCounts[indexPath.section] integerValue]; 184 | dvc.color = indexPath.section; 185 | _selectedItem = indexPath.item; 186 | } 187 | 188 | } 189 | 190 | 191 | //////////////////////////////////////////////////////////////////////////////////////////// 192 | #pragma mark - Collection View Data Source 193 | //////////////////////////////////////////////////////////////////////////////////////////// 194 | 195 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 196 | { 197 | return _sectionCount; 198 | } 199 | 200 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 201 | { 202 | return [_itemCounts[section] integerValue]; 203 | } 204 | 205 | - (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 206 | { 207 | static NSString *CellIdentifier = @"SimpleCell"; 208 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath]; 209 | 210 | NSInteger itemCount = [self collectionView:collectionView numberOfItemsInSection:indexPath.section]; 211 | CGFloat colorValue = 1.0-(indexPath.item+1.0)/(2*itemCount); 212 | 213 | cell.backgroundColor = [UIColor colorWithRed:(indexPath.section==0)?colorValue:0.0 214 | green:(indexPath.section==1)?colorValue:0.0 215 | blue:(indexPath.section==2)?colorValue:0.0 216 | alpha:1.0]; 217 | 218 | return cell; 219 | } 220 | 221 | 222 | 223 | //////////////////////////////////////////////////////////////////////////////////////////// 224 | #pragma mark - Navigation Controller Delegate 225 | //////////////////////////////////////////////////////////////////////////////////////////// 226 | 227 | //- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 228 | //{ 229 | // if ([viewController isKindOfClass:[FJDetailViewController class]]) { 230 | // FJDetailViewController *dvc = (FJDetailViewController*)viewController; 231 | // 232 | // } 233 | // 234 | //} 235 | - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated 236 | { 237 | if ([viewController isKindOfClass:[FJDetailViewController class]]) { 238 | FJDetailViewController *dvc = (FJDetailViewController*)viewController; 239 | dvc.collectionView.dataSource = dvc; 240 | dvc.collectionView.delegate = dvc; 241 | [dvc.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:_selectedItem inSection:0] atScrollPosition:UICollectionViewScrollPositionCenteredVertically animated:NO]; 242 | _pincher.enabled = NO; 243 | } 244 | else if (viewController == self){ 245 | self.collectionView.dataSource = self; 246 | self.collectionView.delegate = self; 247 | _pincher.enabled = YES; 248 | } 249 | } 250 | @end 251 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FJDetailViewController.h 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 27/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, FJSectionColor) { 12 | FJSectionColorRed, 13 | FJSectionColorGreen, 14 | FJSectionColorBlue 15 | }; 16 | 17 | @interface FJDetailViewController : UICollectionViewController 18 | 19 | @property (nonatomic) FJSectionColor color; 20 | @property (nonatomic) NSInteger itemCount; 21 | 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FJDetailViewController.m 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 27/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | 10 | #import "FJDetailViewController.h" 11 | #import "FJFlowLayoutWithAnimations.h" 12 | 13 | @interface FJDetailViewController () 14 | 15 | @end 16 | 17 | @implementation FJDetailViewController 18 | 19 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 20 | { 21 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 22 | if (self) { 23 | // Custom initialization 24 | } 25 | return self; 26 | } 27 | 28 | - (void)viewDidLoad 29 | { 30 | [super viewDidLoad]; 31 | // Do any additional setup after loading the view. 32 | } 33 | 34 | - (void)didReceiveMemoryWarning 35 | { 36 | [super didReceiveMemoryWarning]; 37 | // Dispose of any resources that can be recreated. 38 | } 39 | 40 | /* 41 | #pragma mark - Navigation 42 | 43 | // In a storyboard-based application, you will often want to do a little preparation before navigation 44 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 45 | { 46 | // Get the new view controller using [segue destinationViewController]. 47 | // Pass the selected object to the new view controller. 48 | } 49 | */ 50 | 51 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 52 | { 53 | return 1; 54 | } 55 | 56 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 57 | { 58 | return _itemCount; 59 | } 60 | 61 | - (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 62 | { 63 | static NSString *CellIdentifier = @"DetailCell"; 64 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath]; 65 | 66 | 67 | CGFloat colorValue = 1.0-(indexPath.item+1.0)/(2*_itemCount); 68 | 69 | cell.backgroundColor = [UIColor colorWithRed:(_color == FJSectionColorRed)?colorValue:0.0 70 | green:(_color == FJSectionColorGreen)?colorValue:0.0 71 | blue:(_color == FJSectionColorBlue)?colorValue:0.0 72 | alpha:1.0]; 73 | 74 | return cell; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJFlowLayoutWithAnimations.h: -------------------------------------------------------------------------------- 1 | // 2 | // FJFlowLayoutWithPopAnimations.h 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 26/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FJFlowLayoutWithAnimations : UICollectionViewFlowLayout 12 | 13 | - (void)resizeItemAtIndexPath:(NSIndexPath*)indexPath withPinchDistance:(CGFloat)distance; 14 | - (void)resetPinchedItem; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CollectionViewAnimations/FJFlowLayoutWithAnimations.m: -------------------------------------------------------------------------------- 1 | // 2 | // FJFlowLayoutWithPopAnimations.m 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 26/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import "FJFlowLayoutWithAnimations.h" 10 | 11 | @interface FJFlowLayoutWithAnimations () 12 | 13 | @property (nonatomic) CGSize previousSize; 14 | @property (nonatomic, strong) NSMutableArray *indexPathsToAnimate; 15 | 16 | @property (nonatomic, strong) NSIndexPath *pinchedItem; 17 | @property (nonatomic) CGSize pinchedItemSize; 18 | 19 | @end 20 | 21 | @implementation FJFlowLayoutWithAnimations 22 | 23 | - (void)commonInit 24 | { 25 | self.itemSize = CGSizeMake(50, 50); 26 | self.minimumLineSpacing = 16; 27 | self.sectionInset = UIEdgeInsetsMake(8, 8, 8, 8); 28 | } 29 | 30 | - (instancetype)init 31 | { 32 | self = [super init]; 33 | 34 | if (self) { 35 | [self commonInit]; 36 | } 37 | 38 | return self; 39 | } 40 | 41 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 42 | { 43 | self = [super initWithCoder:aDecoder]; 44 | 45 | if (self) { 46 | [self commonInit]; 47 | } 48 | 49 | return self; 50 | } 51 | 52 | - (NSArray*)layoutAttributesForElementsInRect:(CGRect)rect 53 | { 54 | 55 | NSArray *attrs = [super layoutAttributesForElementsInRect:rect]; 56 | // NSLog(@"attributes for rect %@\n%@", NSStringFromCGRect(rect), attrs); 57 | 58 | if (_pinchedItem) { 59 | UICollectionViewLayoutAttributes *attr = [[attrs filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"indexPath == %@", _pinchedItem]] firstObject]; 60 | 61 | attr.size = _pinchedItemSize; 62 | attr.zIndex = 100; 63 | } 64 | return attrs; 65 | } 66 | 67 | - (UICollectionViewLayoutAttributes*)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath 68 | { 69 | UICollectionViewLayoutAttributes *attr = [super layoutAttributesForItemAtIndexPath:indexPath]; 70 | 71 | if ([indexPath isEqual:_pinchedItem]) { 72 | attr.size = _pinchedItemSize; 73 | attr.zIndex = 100; 74 | } 75 | 76 | return attr; 77 | } 78 | 79 | - (UICollectionViewLayoutAttributes*)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath 80 | { 81 | NSLog(@"%@ initial attr for %@", self, itemIndexPath); 82 | UICollectionViewLayoutAttributes *attr = [self layoutAttributesForItemAtIndexPath:itemIndexPath]; 83 | 84 | if ([_indexPathsToAnimate containsObject:itemIndexPath]) { 85 | attr.transform = CGAffineTransformRotate(CGAffineTransformMakeScale(0.2, 0.2), M_PI); 86 | attr.center = CGPointMake(CGRectGetMidX(self.collectionView.bounds), CGRectGetMaxY(self.collectionView.bounds)); 87 | [_indexPathsToAnimate removeObject:itemIndexPath]; 88 | } 89 | 90 | return attr; 91 | } 92 | 93 | - (UICollectionViewLayoutAttributes*)finalLayoutAttributesForDisappearingItemAtIndexPath:(NSIndexPath *)itemIndexPath 94 | { 95 | NSLog(@"%@ final attr for %@", self, itemIndexPath); 96 | UICollectionViewLayoutAttributes *attr = [self layoutAttributesForItemAtIndexPath:itemIndexPath]; 97 | 98 | if ([_indexPathsToAnimate containsObject:itemIndexPath]) { 99 | 100 | CATransform3D flyUpTransform = CATransform3DIdentity; 101 | flyUpTransform.m34 = 1.0 / -20000; 102 | flyUpTransform = CATransform3DTranslate(flyUpTransform, 0, 0, 19500); 103 | attr.transform3D = flyUpTransform; 104 | attr.center = self.collectionView.center; 105 | 106 | attr.alpha = 0.2; 107 | attr.zIndex = 1; 108 | 109 | [_indexPathsToAnimate removeObject:itemIndexPath]; 110 | } 111 | else{ 112 | attr.alpha = 1.0; 113 | } 114 | 115 | NSLog(@"final %@", attr); 116 | return attr; 117 | } 118 | 119 | - (void)prepareLayout 120 | { 121 | NSLog(@"%@ preparing layout", self); 122 | [super prepareLayout]; 123 | self.previousSize = self.collectionView.bounds.size; 124 | } 125 | 126 | - (void)prepareForCollectionViewUpdates:(NSArray *)updateItems 127 | { 128 | NSLog(@"%@ prepare for updated", self); 129 | [super prepareForCollectionViewUpdates:updateItems]; 130 | NSMutableArray *indexPaths = [NSMutableArray array]; 131 | for (UICollectionViewUpdateItem *updateItem in updateItems) { 132 | switch (updateItem.updateAction) { 133 | case UICollectionUpdateActionInsert: 134 | [indexPaths addObject:updateItem.indexPathAfterUpdate]; 135 | break; 136 | case UICollectionUpdateActionDelete: 137 | [indexPaths addObject:updateItem.indexPathBeforeUpdate]; 138 | break; 139 | case UICollectionUpdateActionMove: 140 | [indexPaths addObject:updateItem.indexPathBeforeUpdate]; 141 | [indexPaths addObject:updateItem.indexPathAfterUpdate]; 142 | break; 143 | default: 144 | NSLog(@"unhandled case: %@", updateItem); 145 | break; 146 | } 147 | } 148 | 149 | self.indexPathsToAnimate = indexPaths; 150 | } 151 | 152 | - (void)finalizeCollectionViewUpdates 153 | { 154 | NSLog(@"%@ finalize updates", self); 155 | [super finalizeCollectionViewUpdates]; 156 | self.indexPathsToAnimate = nil; 157 | } 158 | 159 | - (void)prepareForAnimatedBoundsChange:(CGRect)oldBounds 160 | { 161 | NSLog(@"%@ prepare animated bounds change", self); 162 | [super prepareForAnimatedBoundsChange:oldBounds]; 163 | } 164 | 165 | - (void)finalizeAnimatedBoundsChange { 166 | NSLog(@"%@ finalize animated bounds change", self); 167 | [super finalizeAnimatedBoundsChange]; 168 | } 169 | 170 | - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds 171 | { 172 | CGRect oldBounds = self.collectionView.bounds; 173 | if (!CGSizeEqualToSize(oldBounds.size, newBounds.size)) { 174 | NSLog(@"%@ should invalidate layout", self); 175 | return YES; 176 | 177 | } 178 | return NO; 179 | } 180 | 181 | 182 | - (void)resizeItemAtIndexPath:(NSIndexPath*)indexPath withPinchDistance:(CGFloat)distance 183 | { 184 | self.pinchedItem = indexPath; 185 | self.pinchedItemSize = CGSizeMake(distance, distance); 186 | 187 | } 188 | 189 | - (void)resetPinchedItem 190 | { 191 | self.pinchedItem = nil; 192 | self.pinchedItemSize = CGSizeZero; 193 | } 194 | 195 | 196 | @end 197 | -------------------------------------------------------------------------------- /CollectionViewAnimations/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "size" : "29x29", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "size" : "29x29", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "40x40", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "40x40", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "76x76", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "76x76", 31 | "scale" : "2x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CollectionViewAnimations/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "1x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "extent" : "full-screen", 14 | "minimum-system-version" : "7.0", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "portrait", 19 | "idiom" : "ipad", 20 | "extent" : "full-screen", 21 | "minimum-system-version" : "7.0", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "landscape", 26 | "idiom" : "ipad", 27 | "extent" : "full-screen", 28 | "minimum-system-version" : "7.0", 29 | "scale" : "2x" 30 | } 31 | ], 32 | "info" : { 33 | "version" : 1, 34 | "author" : "xcode" 35 | } 36 | } -------------------------------------------------------------------------------- /CollectionViewAnimations/Storyboard.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 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 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /CollectionViewAnimations/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CollectionViewAnimations/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CollectionViewAnimations 4 | // 5 | // Created by Engin Kurutepe on 21/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "FJAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([FJAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CollectionViewAnimationsTests/CollectionViewAnimationsTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.fifteenjugglers.${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 | -------------------------------------------------------------------------------- /CollectionViewAnimationsTests/CollectionViewAnimationsTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewAnimationsTests.m 3 | // CollectionViewAnimationsTests 4 | // 5 | // Created by Engin Kurutepe on 21/04/14. 6 | // Copyright (c) 2014 Fifteen Jugglers Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CollectionViewAnimationsTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CollectionViewAnimationsTests 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 | -------------------------------------------------------------------------------- /CollectionViewAnimationsTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Collection-View-Animations 2 | ========================== 3 | 4 | A demo project 5 | --------------------------------------------------------------------------------