├── README.md ├── UIDynamicTest.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── Macx.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Macx.xcuserdatad │ └── xcschemes │ ├── UIDynamicTest.xcscheme │ └── xcschememanagement.plist ├── UIDynamicTest ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── BackgroundTile.imageset │ │ ├── BackgroundTile@2x的副本.png │ │ └── Contents.json │ ├── Box1.imageset │ │ ├── Box1@2x的副本.png │ │ └── Contents.json │ ├── Contents.json │ ├── first.imageset │ │ ├── Contents.json │ │ └── first.pdf │ └── second.imageset │ │ ├── Contents.json │ │ └── second.pdf ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── FirstViewController.h ├── FirstViewController.m ├── Info.plist ├── SecondViewController.h ├── SecondViewController.m ├── WPFBaseView.h ├── WPFBaseView.m ├── WPFCollisionView.h ├── WPFCollisionView.m └── main.m ├── UIDynamicTestTests ├── Info.plist └── UIDynamicTestTests.m ├── UIDynamicTestUITests ├── Info.plist └── UIDynamicTestUITests.m └── test.gif /README.md: -------------------------------------------------------------------------------- 1 | # UIDynamicTest 2 | 仿掌上英雄联盟重力粒子效果 3 | ![](https://github.com/wutao66/UIDynamicTest/blob/master/test.gif) 4 | 5 | 6 | 欢迎移步简书地址: http://www.jianshu.com/p/605b37b3105c 7 | -------------------------------------------------------------------------------- /UIDynamicTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8F2658741F5E9E92002631E0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2658731F5E9E92002631E0 /* main.m */; }; 11 | 8F2658771F5E9E92002631E0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2658761F5E9E92002631E0 /* AppDelegate.m */; }; 12 | 8F26587A1F5E9E92002631E0 /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2658791F5E9E92002631E0 /* FirstViewController.m */; }; 13 | 8F26587D1F5E9E92002631E0 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F26587C1F5E9E92002631E0 /* SecondViewController.m */; }; 14 | 8F2658801F5E9E92002631E0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F26587E1F5E9E92002631E0 /* Main.storyboard */; }; 15 | 8F2658821F5E9E92002631E0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8F2658811F5E9E92002631E0 /* Assets.xcassets */; }; 16 | 8F2658851F5E9E92002631E0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F2658831F5E9E92002631E0 /* LaunchScreen.storyboard */; }; 17 | 8F2658901F5E9E92002631E0 /* UIDynamicTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F26588F1F5E9E92002631E0 /* UIDynamicTestTests.m */; }; 18 | 8F26589B1F5E9E92002631E0 /* UIDynamicTestUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F26589A1F5E9E92002631E0 /* UIDynamicTestUITests.m */; }; 19 | 8F2658AC1F5E9EB7002631E0 /* WPFBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2658A91F5E9EB7002631E0 /* WPFBaseView.m */; }; 20 | 8F2658AD1F5E9EB7002631E0 /* WPFCollisionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2658AB1F5E9EB7002631E0 /* WPFCollisionView.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 8F26588C1F5E9E92002631E0 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 8F2658671F5E9E92002631E0 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 8F26586E1F5E9E92002631E0; 29 | remoteInfo = UIDynamicTest; 30 | }; 31 | 8F2658971F5E9E92002631E0 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 8F2658671F5E9E92002631E0 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 8F26586E1F5E9E92002631E0; 36 | remoteInfo = UIDynamicTest; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 8F26586F1F5E9E92002631E0 /* UIDynamicTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIDynamicTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 8F2658731F5E9E92002631E0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 8F2658751F5E9E92002631E0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 44 | 8F2658761F5E9E92002631E0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 45 | 8F2658781F5E9E92002631E0 /* FirstViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = ""; }; 46 | 8F2658791F5E9E92002631E0 /* FirstViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = ""; }; 47 | 8F26587B1F5E9E92002631E0 /* SecondViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; 48 | 8F26587C1F5E9E92002631E0 /* SecondViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; 49 | 8F26587F1F5E9E92002631E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 8F2658811F5E9E92002631E0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 8F2658841F5E9E92002631E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 8F2658861F5E9E92002631E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 8F26588B1F5E9E92002631E0 /* UIDynamicTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UIDynamicTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 8F26588F1F5E9E92002631E0 /* UIDynamicTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIDynamicTestTests.m; sourceTree = ""; }; 55 | 8F2658911F5E9E92002631E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 8F2658961F5E9E92002631E0 /* UIDynamicTestUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UIDynamicTestUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 8F26589A1F5E9E92002631E0 /* UIDynamicTestUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIDynamicTestUITests.m; sourceTree = ""; }; 58 | 8F26589C1F5E9E92002631E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | 8F2658A81F5E9EB7002631E0 /* WPFBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFBaseView.h; sourceTree = ""; }; 60 | 8F2658A91F5E9EB7002631E0 /* WPFBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFBaseView.m; sourceTree = ""; }; 61 | 8F2658AA1F5E9EB7002631E0 /* WPFCollisionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFCollisionView.h; sourceTree = ""; }; 62 | 8F2658AB1F5E9EB7002631E0 /* WPFCollisionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFCollisionView.m; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 8F26586C1F5E9E92002631E0 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 8F2658881F5E9E92002631E0 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | 8F2658931F5E9E92002631E0 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 8F2658661F5E9E92002631E0 = { 91 | isa = PBXGroup; 92 | children = ( 93 | 8F2658711F5E9E92002631E0 /* UIDynamicTest */, 94 | 8F26588E1F5E9E92002631E0 /* UIDynamicTestTests */, 95 | 8F2658991F5E9E92002631E0 /* UIDynamicTestUITests */, 96 | 8F2658701F5E9E92002631E0 /* Products */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 8F2658701F5E9E92002631E0 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 8F26586F1F5E9E92002631E0 /* UIDynamicTest.app */, 104 | 8F26588B1F5E9E92002631E0 /* UIDynamicTestTests.xctest */, 105 | 8F2658961F5E9E92002631E0 /* UIDynamicTestUITests.xctest */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | 8F2658711F5E9E92002631E0 /* UIDynamicTest */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 8F2658751F5E9E92002631E0 /* AppDelegate.h */, 114 | 8F2658761F5E9E92002631E0 /* AppDelegate.m */, 115 | 8F2658A81F5E9EB7002631E0 /* WPFBaseView.h */, 116 | 8F2658A91F5E9EB7002631E0 /* WPFBaseView.m */, 117 | 8F2658AA1F5E9EB7002631E0 /* WPFCollisionView.h */, 118 | 8F2658AB1F5E9EB7002631E0 /* WPFCollisionView.m */, 119 | 8F2658781F5E9E92002631E0 /* FirstViewController.h */, 120 | 8F2658791F5E9E92002631E0 /* FirstViewController.m */, 121 | 8F26587B1F5E9E92002631E0 /* SecondViewController.h */, 122 | 8F26587C1F5E9E92002631E0 /* SecondViewController.m */, 123 | 8F26587E1F5E9E92002631E0 /* Main.storyboard */, 124 | 8F2658811F5E9E92002631E0 /* Assets.xcassets */, 125 | 8F2658831F5E9E92002631E0 /* LaunchScreen.storyboard */, 126 | 8F2658861F5E9E92002631E0 /* Info.plist */, 127 | 8F2658721F5E9E92002631E0 /* Supporting Files */, 128 | ); 129 | path = UIDynamicTest; 130 | sourceTree = ""; 131 | }; 132 | 8F2658721F5E9E92002631E0 /* Supporting Files */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 8F2658731F5E9E92002631E0 /* main.m */, 136 | ); 137 | name = "Supporting Files"; 138 | sourceTree = ""; 139 | }; 140 | 8F26588E1F5E9E92002631E0 /* UIDynamicTestTests */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 8F26588F1F5E9E92002631E0 /* UIDynamicTestTests.m */, 144 | 8F2658911F5E9E92002631E0 /* Info.plist */, 145 | ); 146 | path = UIDynamicTestTests; 147 | sourceTree = ""; 148 | }; 149 | 8F2658991F5E9E92002631E0 /* UIDynamicTestUITests */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 8F26589A1F5E9E92002631E0 /* UIDynamicTestUITests.m */, 153 | 8F26589C1F5E9E92002631E0 /* Info.plist */, 154 | ); 155 | path = UIDynamicTestUITests; 156 | sourceTree = ""; 157 | }; 158 | /* End PBXGroup section */ 159 | 160 | /* Begin PBXNativeTarget section */ 161 | 8F26586E1F5E9E92002631E0 /* UIDynamicTest */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = 8F26589F1F5E9E92002631E0 /* Build configuration list for PBXNativeTarget "UIDynamicTest" */; 164 | buildPhases = ( 165 | 8F26586B1F5E9E92002631E0 /* Sources */, 166 | 8F26586C1F5E9E92002631E0 /* Frameworks */, 167 | 8F26586D1F5E9E92002631E0 /* Resources */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | ); 173 | name = UIDynamicTest; 174 | productName = UIDynamicTest; 175 | productReference = 8F26586F1F5E9E92002631E0 /* UIDynamicTest.app */; 176 | productType = "com.apple.product-type.application"; 177 | }; 178 | 8F26588A1F5E9E92002631E0 /* UIDynamicTestTests */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = 8F2658A21F5E9E92002631E0 /* Build configuration list for PBXNativeTarget "UIDynamicTestTests" */; 181 | buildPhases = ( 182 | 8F2658871F5E9E92002631E0 /* Sources */, 183 | 8F2658881F5E9E92002631E0 /* Frameworks */, 184 | 8F2658891F5E9E92002631E0 /* Resources */, 185 | ); 186 | buildRules = ( 187 | ); 188 | dependencies = ( 189 | 8F26588D1F5E9E92002631E0 /* PBXTargetDependency */, 190 | ); 191 | name = UIDynamicTestTests; 192 | productName = UIDynamicTestTests; 193 | productReference = 8F26588B1F5E9E92002631E0 /* UIDynamicTestTests.xctest */; 194 | productType = "com.apple.product-type.bundle.unit-test"; 195 | }; 196 | 8F2658951F5E9E92002631E0 /* UIDynamicTestUITests */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = 8F2658A51F5E9E92002631E0 /* Build configuration list for PBXNativeTarget "UIDynamicTestUITests" */; 199 | buildPhases = ( 200 | 8F2658921F5E9E92002631E0 /* Sources */, 201 | 8F2658931F5E9E92002631E0 /* Frameworks */, 202 | 8F2658941F5E9E92002631E0 /* Resources */, 203 | ); 204 | buildRules = ( 205 | ); 206 | dependencies = ( 207 | 8F2658981F5E9E92002631E0 /* PBXTargetDependency */, 208 | ); 209 | name = UIDynamicTestUITests; 210 | productName = UIDynamicTestUITests; 211 | productReference = 8F2658961F5E9E92002631E0 /* UIDynamicTestUITests.xctest */; 212 | productType = "com.apple.product-type.bundle.ui-testing"; 213 | }; 214 | /* End PBXNativeTarget section */ 215 | 216 | /* Begin PBXProject section */ 217 | 8F2658671F5E9E92002631E0 /* Project object */ = { 218 | isa = PBXProject; 219 | attributes = { 220 | LastUpgradeCheck = 0810; 221 | ORGANIZATIONNAME = wt; 222 | TargetAttributes = { 223 | 8F26586E1F5E9E92002631E0 = { 224 | CreatedOnToolsVersion = 8.1; 225 | DevelopmentTeam = VVUGCJ98P5; 226 | ProvisioningStyle = Automatic; 227 | }; 228 | 8F26588A1F5E9E92002631E0 = { 229 | CreatedOnToolsVersion = 8.1; 230 | DevelopmentTeam = VVUGCJ98P5; 231 | ProvisioningStyle = Automatic; 232 | TestTargetID = 8F26586E1F5E9E92002631E0; 233 | }; 234 | 8F2658951F5E9E92002631E0 = { 235 | CreatedOnToolsVersion = 8.1; 236 | DevelopmentTeam = VVUGCJ98P5; 237 | ProvisioningStyle = Automatic; 238 | TestTargetID = 8F26586E1F5E9E92002631E0; 239 | }; 240 | }; 241 | }; 242 | buildConfigurationList = 8F26586A1F5E9E92002631E0 /* Build configuration list for PBXProject "UIDynamicTest" */; 243 | compatibilityVersion = "Xcode 3.2"; 244 | developmentRegion = English; 245 | hasScannedForEncodings = 0; 246 | knownRegions = ( 247 | en, 248 | Base, 249 | ); 250 | mainGroup = 8F2658661F5E9E92002631E0; 251 | productRefGroup = 8F2658701F5E9E92002631E0 /* Products */; 252 | projectDirPath = ""; 253 | projectRoot = ""; 254 | targets = ( 255 | 8F26586E1F5E9E92002631E0 /* UIDynamicTest */, 256 | 8F26588A1F5E9E92002631E0 /* UIDynamicTestTests */, 257 | 8F2658951F5E9E92002631E0 /* UIDynamicTestUITests */, 258 | ); 259 | }; 260 | /* End PBXProject section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | 8F26586D1F5E9E92002631E0 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 8F2658851F5E9E92002631E0 /* LaunchScreen.storyboard in Resources */, 268 | 8F2658821F5E9E92002631E0 /* Assets.xcassets in Resources */, 269 | 8F2658801F5E9E92002631E0 /* Main.storyboard in Resources */, 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | }; 273 | 8F2658891F5E9E92002631E0 /* Resources */ = { 274 | isa = PBXResourcesBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | 8F2658941F5E9E92002631E0 /* Resources */ = { 281 | isa = PBXResourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | /* End PBXResourcesBuildPhase section */ 288 | 289 | /* Begin PBXSourcesBuildPhase section */ 290 | 8F26586B1F5E9E92002631E0 /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 8F26587D1F5E9E92002631E0 /* SecondViewController.m in Sources */, 295 | 8F2658771F5E9E92002631E0 /* AppDelegate.m in Sources */, 296 | 8F2658AC1F5E9EB7002631E0 /* WPFBaseView.m in Sources */, 297 | 8F2658AD1F5E9EB7002631E0 /* WPFCollisionView.m in Sources */, 298 | 8F26587A1F5E9E92002631E0 /* FirstViewController.m in Sources */, 299 | 8F2658741F5E9E92002631E0 /* main.m in Sources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | 8F2658871F5E9E92002631E0 /* Sources */ = { 304 | isa = PBXSourcesBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | 8F2658901F5E9E92002631E0 /* UIDynamicTestTests.m in Sources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | 8F2658921F5E9E92002631E0 /* Sources */ = { 312 | isa = PBXSourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | 8F26589B1F5E9E92002631E0 /* UIDynamicTestUITests.m in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | /* End PBXSourcesBuildPhase section */ 320 | 321 | /* Begin PBXTargetDependency section */ 322 | 8F26588D1F5E9E92002631E0 /* PBXTargetDependency */ = { 323 | isa = PBXTargetDependency; 324 | target = 8F26586E1F5E9E92002631E0 /* UIDynamicTest */; 325 | targetProxy = 8F26588C1F5E9E92002631E0 /* PBXContainerItemProxy */; 326 | }; 327 | 8F2658981F5E9E92002631E0 /* PBXTargetDependency */ = { 328 | isa = PBXTargetDependency; 329 | target = 8F26586E1F5E9E92002631E0 /* UIDynamicTest */; 330 | targetProxy = 8F2658971F5E9E92002631E0 /* PBXContainerItemProxy */; 331 | }; 332 | /* End PBXTargetDependency section */ 333 | 334 | /* Begin PBXVariantGroup section */ 335 | 8F26587E1F5E9E92002631E0 /* Main.storyboard */ = { 336 | isa = PBXVariantGroup; 337 | children = ( 338 | 8F26587F1F5E9E92002631E0 /* Base */, 339 | ); 340 | name = Main.storyboard; 341 | sourceTree = ""; 342 | }; 343 | 8F2658831F5E9E92002631E0 /* LaunchScreen.storyboard */ = { 344 | isa = PBXVariantGroup; 345 | children = ( 346 | 8F2658841F5E9E92002631E0 /* Base */, 347 | ); 348 | name = LaunchScreen.storyboard; 349 | sourceTree = ""; 350 | }; 351 | /* End PBXVariantGroup section */ 352 | 353 | /* Begin XCBuildConfiguration section */ 354 | 8F26589D1F5E9E92002631E0 /* Debug */ = { 355 | isa = XCBuildConfiguration; 356 | buildSettings = { 357 | ALWAYS_SEARCH_USER_PATHS = NO; 358 | CLANG_ANALYZER_NONNULL = YES; 359 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 360 | CLANG_CXX_LIBRARY = "libc++"; 361 | CLANG_ENABLE_MODULES = YES; 362 | CLANG_ENABLE_OBJC_ARC = YES; 363 | CLANG_WARN_BOOL_CONVERSION = YES; 364 | CLANG_WARN_CONSTANT_CONVERSION = YES; 365 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 366 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 367 | CLANG_WARN_EMPTY_BODY = YES; 368 | CLANG_WARN_ENUM_CONVERSION = YES; 369 | CLANG_WARN_INFINITE_RECURSION = YES; 370 | CLANG_WARN_INT_CONVERSION = YES; 371 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 372 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 373 | CLANG_WARN_UNREACHABLE_CODE = YES; 374 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 375 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 376 | COPY_PHASE_STRIP = NO; 377 | DEBUG_INFORMATION_FORMAT = dwarf; 378 | ENABLE_STRICT_OBJC_MSGSEND = YES; 379 | ENABLE_TESTABILITY = YES; 380 | GCC_C_LANGUAGE_STANDARD = gnu99; 381 | GCC_DYNAMIC_NO_PIC = NO; 382 | GCC_NO_COMMON_BLOCKS = YES; 383 | GCC_OPTIMIZATION_LEVEL = 0; 384 | GCC_PREPROCESSOR_DEFINITIONS = ( 385 | "DEBUG=1", 386 | "$(inherited)", 387 | ); 388 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 389 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 390 | GCC_WARN_UNDECLARED_SELECTOR = YES; 391 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 392 | GCC_WARN_UNUSED_FUNCTION = YES; 393 | GCC_WARN_UNUSED_VARIABLE = YES; 394 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 395 | MTL_ENABLE_DEBUG_INFO = YES; 396 | ONLY_ACTIVE_ARCH = YES; 397 | SDKROOT = iphoneos; 398 | TARGETED_DEVICE_FAMILY = "1,2"; 399 | }; 400 | name = Debug; 401 | }; 402 | 8F26589E1F5E9E92002631E0 /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ALWAYS_SEARCH_USER_PATHS = NO; 406 | CLANG_ANALYZER_NONNULL = YES; 407 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 408 | CLANG_CXX_LIBRARY = "libc++"; 409 | CLANG_ENABLE_MODULES = YES; 410 | CLANG_ENABLE_OBJC_ARC = YES; 411 | CLANG_WARN_BOOL_CONVERSION = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 415 | CLANG_WARN_EMPTY_BODY = YES; 416 | CLANG_WARN_ENUM_CONVERSION = YES; 417 | CLANG_WARN_INFINITE_RECURSION = YES; 418 | CLANG_WARN_INT_CONVERSION = YES; 419 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 420 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 421 | CLANG_WARN_UNREACHABLE_CODE = YES; 422 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 423 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 424 | COPY_PHASE_STRIP = NO; 425 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 426 | ENABLE_NS_ASSERTIONS = NO; 427 | ENABLE_STRICT_OBJC_MSGSEND = YES; 428 | GCC_C_LANGUAGE_STANDARD = gnu99; 429 | GCC_NO_COMMON_BLOCKS = YES; 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 437 | MTL_ENABLE_DEBUG_INFO = NO; 438 | SDKROOT = iphoneos; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | VALIDATE_PRODUCT = YES; 441 | }; 442 | name = Release; 443 | }; 444 | 8F2658A01F5E9E92002631E0 /* Debug */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | DEVELOPMENT_TEAM = VVUGCJ98P5; 449 | INFOPLIST_FILE = UIDynamicTest/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | PRODUCT_BUNDLE_IDENTIFIER = wt.UIDynamicTest; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | }; 454 | name = Debug; 455 | }; 456 | 8F2658A11F5E9E92002631E0 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 460 | DEVELOPMENT_TEAM = VVUGCJ98P5; 461 | INFOPLIST_FILE = UIDynamicTest/Info.plist; 462 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 463 | PRODUCT_BUNDLE_IDENTIFIER = wt.UIDynamicTest; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | }; 466 | name = Release; 467 | }; 468 | 8F2658A31F5E9E92002631E0 /* Debug */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | BUNDLE_LOADER = "$(TEST_HOST)"; 472 | DEVELOPMENT_TEAM = VVUGCJ98P5; 473 | INFOPLIST_FILE = UIDynamicTestTests/Info.plist; 474 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 475 | PRODUCT_BUNDLE_IDENTIFIER = wt.UIDynamicTestTests; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIDynamicTest.app/UIDynamicTest"; 478 | }; 479 | name = Debug; 480 | }; 481 | 8F2658A41F5E9E92002631E0 /* Release */ = { 482 | isa = XCBuildConfiguration; 483 | buildSettings = { 484 | BUNDLE_LOADER = "$(TEST_HOST)"; 485 | DEVELOPMENT_TEAM = VVUGCJ98P5; 486 | INFOPLIST_FILE = UIDynamicTestTests/Info.plist; 487 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 488 | PRODUCT_BUNDLE_IDENTIFIER = wt.UIDynamicTestTests; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIDynamicTest.app/UIDynamicTest"; 491 | }; 492 | name = Release; 493 | }; 494 | 8F2658A61F5E9E92002631E0 /* Debug */ = { 495 | isa = XCBuildConfiguration; 496 | buildSettings = { 497 | DEVELOPMENT_TEAM = VVUGCJ98P5; 498 | INFOPLIST_FILE = UIDynamicTestUITests/Info.plist; 499 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 500 | PRODUCT_BUNDLE_IDENTIFIER = wt.UIDynamicTestUITests; 501 | PRODUCT_NAME = "$(TARGET_NAME)"; 502 | TEST_TARGET_NAME = UIDynamicTest; 503 | }; 504 | name = Debug; 505 | }; 506 | 8F2658A71F5E9E92002631E0 /* Release */ = { 507 | isa = XCBuildConfiguration; 508 | buildSettings = { 509 | DEVELOPMENT_TEAM = VVUGCJ98P5; 510 | INFOPLIST_FILE = UIDynamicTestUITests/Info.plist; 511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 512 | PRODUCT_BUNDLE_IDENTIFIER = wt.UIDynamicTestUITests; 513 | PRODUCT_NAME = "$(TARGET_NAME)"; 514 | TEST_TARGET_NAME = UIDynamicTest; 515 | }; 516 | name = Release; 517 | }; 518 | /* End XCBuildConfiguration section */ 519 | 520 | /* Begin XCConfigurationList section */ 521 | 8F26586A1F5E9E92002631E0 /* Build configuration list for PBXProject "UIDynamicTest" */ = { 522 | isa = XCConfigurationList; 523 | buildConfigurations = ( 524 | 8F26589D1F5E9E92002631E0 /* Debug */, 525 | 8F26589E1F5E9E92002631E0 /* Release */, 526 | ); 527 | defaultConfigurationIsVisible = 0; 528 | defaultConfigurationName = Release; 529 | }; 530 | 8F26589F1F5E9E92002631E0 /* Build configuration list for PBXNativeTarget "UIDynamicTest" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | 8F2658A01F5E9E92002631E0 /* Debug */, 534 | 8F2658A11F5E9E92002631E0 /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | }; 538 | 8F2658A21F5E9E92002631E0 /* Build configuration list for PBXNativeTarget "UIDynamicTestTests" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | 8F2658A31F5E9E92002631E0 /* Debug */, 542 | 8F2658A41F5E9E92002631E0 /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | }; 546 | 8F2658A51F5E9E92002631E0 /* Build configuration list for PBXNativeTarget "UIDynamicTestUITests" */ = { 547 | isa = XCConfigurationList; 548 | buildConfigurations = ( 549 | 8F2658A61F5E9E92002631E0 /* Debug */, 550 | 8F2658A71F5E9E92002631E0 /* Release */, 551 | ); 552 | defaultConfigurationIsVisible = 0; 553 | }; 554 | /* End XCConfigurationList section */ 555 | }; 556 | rootObject = 8F2658671F5E9E92002631E0 /* Project object */; 557 | } 558 | -------------------------------------------------------------------------------- /UIDynamicTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /UIDynamicTest.xcodeproj/project.xcworkspace/xcuserdata/Macx.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutao66/UIDynamicTest/2769938b8746ad8d955778cf7a461319eed167e4/UIDynamicTest.xcodeproj/project.xcworkspace/xcuserdata/Macx.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /UIDynamicTest.xcodeproj/xcuserdata/Macx.xcuserdatad/xcschemes/UIDynamicTest.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /UIDynamicTest.xcodeproj/xcuserdata/Macx.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | UIDynamicTest.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8F26586E1F5E9E92002631E0 16 | 17 | primary 18 | 19 | 20 | 8F26588A1F5E9E92002631E0 21 | 22 | primary 23 | 24 | 25 | 8F2658951F5E9E92002631E0 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /UIDynamicTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // UIDynamicTest 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. 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 | -------------------------------------------------------------------------------- /UIDynamicTest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // UIDynamicTest 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/BackgroundTile.imageset/BackgroundTile@2x的副本.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutao66/UIDynamicTest/2769938b8746ad8d955778cf7a461319eed167e4/UIDynamicTest/Assets.xcassets/BackgroundTile.imageset/BackgroundTile@2x的副本.png -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/BackgroundTile.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "BackgroundTile@2x的副本.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/Box1.imageset/Box1@2x的副本.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutao66/UIDynamicTest/2769938b8746ad8d955778cf7a461319eed167e4/UIDynamicTest/Assets.xcassets/Box1.imageset/Box1@2x的副本.png -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/Box1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Box1@2x的副本.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/first.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "first.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/first.imageset/first.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutao66/UIDynamicTest/2769938b8746ad8d955778cf7a461319eed167e4/UIDynamicTest/Assets.xcassets/first.imageset/first.pdf -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/second.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "second.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /UIDynamicTest/Assets.xcassets/second.imageset/second.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutao66/UIDynamicTest/2769938b8746ad8d955778cf7a461319eed167e4/UIDynamicTest/Assets.xcassets/second.imageset/second.pdf -------------------------------------------------------------------------------- /UIDynamicTest/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 | -------------------------------------------------------------------------------- /UIDynamicTest/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 50 | 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 | -------------------------------------------------------------------------------- /UIDynamicTest/FirstViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.h 3 | // UIDynamicTest 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FirstViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /UIDynamicTest/FirstViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.m 3 | // cs 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. All rights reserved. 7 | // 8 | 9 | #import "FirstViewController.h" 10 | #import "WPFCollisionView.h" 11 | #import "WPFBaseView.h" 12 | #import 13 | 14 | @interface FirstViewController (){ 15 | NSTimeInterval updateInterval; 16 | } 17 | 18 | @property (nonatomic,strong) CMMotionManager *mManager; 19 | @property (assign) double scale; 20 | @property (nonatomic,strong) WPFBaseView * baseView; 21 | 22 | @end 23 | 24 | @implementation FirstViewController 25 | 26 | - (CMMotionManager *)mManager 27 | { 28 | if (!_mManager) { 29 | updateInterval = 1.0/10.0; 30 | _mManager = [[CMMotionManager alloc] init]; 31 | } 32 | return _mManager; 33 | } 34 | 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | 38 | self.scale = 1.0; 39 | 40 | self.baseView = [[WPFCollisionView alloc] init]; 41 | self.baseView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 49); 42 | 43 | [self.view addSubview:self.baseView]; 44 | 45 | 46 | if ([self.mManager isAccelerometerAvailable] == YES) { 47 | //回调会一直调用,建议获取到就调用下面的停止方法,需要再重新开始,当然如果需求是实时不间断的话可以等离开页面之后再stop 48 | [self.mManager setAccelerometerUpdateInterval:updateInterval]; 49 | [self.mManager startAccelerometerUpdatesToQueue:[NSOperationQueue currentQueue] withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) 50 | { 51 | double x = accelerometerData.acceleration.x; 52 | double y = accelerometerData.acceleration.y; 53 | if (fabs(y) >= fabs(x)) 54 | { 55 | if (y >= 0){ 56 | 57 | NSLog(@"Down"); 58 | //Down 59 | } 60 | else{ 61 | NSLog(@"Portrait"); 62 | 63 | //Portrait 64 | } 65 | } 66 | else 67 | { 68 | if (x >= 0){ 69 | NSLog(@"Right"); 70 | 71 | //Right 72 | } 73 | else{ 74 | NSLog(@"Left"); 75 | 76 | //Left 77 | } 78 | 79 | } 80 | 81 | 82 | // 1. 计算偏移量 83 | CGPoint offset = CGPointMake(accelerometerData.acceleration.x,-accelerometerData.acceleration.y); 84 | // 2. 计算角度 85 | CGFloat angle = atan2(offset.y, offset.x); 86 | // 3. 计算距离 87 | CGFloat distance = hypot(offset.y, offset.x); 88 | // 4. 设置推动的大小、角度 89 | self.baseView.push.magnitude = distance; 90 | self.baseView.push.angle = angle; 91 | // 5. 使单次推行为有效 92 | self.baseView.push.active = YES; 93 | 94 | 95 | 96 | }]; 97 | } 98 | 99 | } 100 | 101 | - (void)didReceiveMemoryWarning { 102 | [super didReceiveMemoryWarning]; 103 | // Dispose of any resources that can be recreated. 104 | } 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /UIDynamicTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarTintParameters 32 | 33 | UINavigationBar 34 | 35 | Style 36 | UIBarStyleDefault 37 | Translucent 38 | 39 | 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | UISupportedInterfaceOrientations~ipad 48 | 49 | UIInterfaceOrientationPortrait 50 | UIInterfaceOrientationPortraitUpsideDown 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /UIDynamicTest/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // UIDynamicTest 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SecondViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /UIDynamicTest/SecondViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.m 3 | // UIDynamicTest 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. All rights reserved. 7 | // 8 | 9 | #import "SecondViewController.h" 10 | 11 | @interface SecondViewController () 12 | 13 | @end 14 | 15 | @implementation SecondViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /UIDynamicTest/WPFBaseView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFBaseView.h 3 | // 4 | // Created by wt on 17/9/5. 5 | // Copyright © 2017年 wt. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface WPFBaseView : UIView 11 | 12 | /** 方块视图 */ 13 | @property (nonatomic, weak) UIImageView *boxView; 14 | 15 | @property (nonatomic, weak) UIImageView *boxViewOther; 16 | 17 | @property (nonatomic, weak) UIImageView *boxView3; 18 | @property (nonatomic, weak) UIImageView *boxView4; 19 | @property (nonatomic, weak) UIImageView *boxView5; 20 | 21 | /** 仿真者 */ 22 | @property (nonatomic, strong) UIDynamicAnimator *animator; 23 | 24 | @property (nonatomic, strong) UIPushBehavior *push; 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /UIDynamicTest/WPFBaseView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFBaseView.m 3 | // 4 | // Created by wt on 17/9/5. 5 | // Copyright © 2017年 wt. All rights reserved. 6 | // 7 | 8 | #import "WPFBaseView.h" 9 | 10 | @implementation WPFBaseView 11 | 12 | - (instancetype)initWithFrame:(CGRect)frame { 13 | 14 | if (self = [super initWithFrame:frame]) { 15 | // 设置背景 16 | self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"BackgroundTile"]]; 17 | 18 | // 设置方块 19 | UIImageView *boxView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Box1"]]; 20 | boxView.frame = CGRectMake(0, 0, 30, 30); 21 | boxView.center = CGPointMake(100, 50); 22 | [self addSubview:boxView]; 23 | self.boxView = boxView; 24 | 25 | 26 | UIImageView *boxView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Box1"]]; 27 | boxView2.frame = CGRectMake(0, 0, 30, 30); 28 | boxView2.center = CGPointMake(150, 50); 29 | [self addSubview:boxView2]; 30 | 31 | self.boxViewOther = boxView2; 32 | 33 | 34 | 35 | UIImageView *boxView3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Box1"]]; 36 | boxView3.frame = CGRectMake(0, 0, 30, 30); 37 | boxView3.center = CGPointMake(190, 50); 38 | [self addSubview:boxView3]; 39 | self.boxView3 = boxView3; 40 | 41 | 42 | UIImageView *boxView4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Box1"]]; 43 | boxView4.frame = CGRectMake(0, 0, 30, 30); 44 | boxView4.center = CGPointMake(230, 50); 45 | [self addSubview:boxView4]; 46 | self.boxView4 = boxView4; 47 | UIImageView *boxView5 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Box1"]]; 48 | boxView5.frame = CGRectMake(0, 0, 30, 30); 49 | boxView5.center = CGPointMake(270, 50); 50 | [self addSubview:boxView5]; 51 | self.boxView5 = boxView5; 52 | 53 | 54 | // self.boxView3 = boxView3; 55 | // self.boxView4 = boxView4; 56 | // self.boxView5 = boxView5; 57 | 58 | // 初始化仿真者 59 | UIDynamicAnimator *animator = [[UIDynamicAnimator alloc] initWithReferenceView:self]; 60 | 61 | self.animator = animator; 62 | } 63 | 64 | return self; 65 | 66 | } 67 | 68 | 69 | 70 | /* 71 | // Only override drawRect: if you perform custom drawing. 72 | // An empty implementation adversely affects performance during animation. 73 | - (void)drawRect:(CGRect)rect { 74 | // Drawing code 75 | } 76 | */ 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /UIDynamicTest/WPFCollisionView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFCollisionView.h 3 | // 4 | // Created by wt on 17/9/5. 5 | // Copyright © 2017年 wt. All rights reserved. 6 | // 7 | 8 | #import "WPFBaseView.h" 9 | 10 | @interface WPFCollisionView : WPFBaseView 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /UIDynamicTest/WPFCollisionView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFCollisionView.m 3 | // 4 | // Created by wt on 17/9/5. 5 | // Copyright © 2017年 wt. All rights reserved. 6 | // 7 | 8 | #import "WPFCollisionView.h" 9 | 10 | @interface WPFCollisionView () 11 | 12 | @end 13 | 14 | @implementation WPFCollisionView 15 | 16 | 17 | - (instancetype)init { 18 | 19 | if (self = [super init]) { 20 | 21 | self.boxView.center = CGPointMake(190, 0); 22 | 23 | // 1. 添加重力行为 24 | UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:@[self.boxView,self.boxViewOther,self.boxView3,self.boxView4,self.boxView5]]; 25 | 26 | [self.animator addBehavior:gravity]; 27 | 28 | // 2. 边缘检测 29 | // 如果把红色view 也加边缘检测,则碰撞后红色View 也会被碰掉,因此要手动添加边界 30 | UICollisionBehavior *collision = [[UICollisionBehavior alloc] initWithItems:@[self.boxView,self.boxViewOther,self.boxView3,self.boxView4,self.boxView5]]; 31 | // 让碰撞的行为生效 32 | collision.translatesReferenceBoundsIntoBoundary = YES; 33 | 34 | collision.collisionDelegate = self; 35 | 36 | 37 | // // 3. 添加一个红色view 38 | // UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, 350, 180, 30)]; 39 | // redView.backgroundColor = [UIColor redColor]; 40 | // [self addSubview:redView]; 41 | // 42 | // 43 | // // 4. 手动添加边界 44 | // UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRect:redView.frame]; 45 | // 46 | // [collision addBoundaryWithIdentifier:@"redBoundary" forPath:bezierPath]; 47 | 48 | [self.animator addBehavior:collision]; 49 | 50 | // 5. 物体的属性行为 51 | UIDynamicItemBehavior *item = [[UIDynamicItemBehavior alloc] initWithItems:@[self.boxView,self.boxViewOther,self.boxView3,self.boxView4,self.boxView5]]; 52 | 53 | // 设置物体弹性,振幅 54 | item.elasticity = 0.5; 55 | [self.animator addBehavior:item]; 56 | 57 | 58 | self.push = [[UIPushBehavior alloc] initWithItems:@[self.boxView,self.boxViewOther,self.boxView3,self.boxView4,self.boxView5] mode:UIPushBehaviorModeInstantaneous]; 59 | [self.animator addBehavior:self.push]; 60 | 61 | 62 | 63 | } 64 | return self; 65 | } 66 | 67 | 68 | #pragma mark - UICollisionBehaviorDelegate 69 | // 在碰撞的时候调用 70 | - (void)collisionBehavior:(UICollisionBehavior *)behavior beganContactForItem:(id)item withBoundaryIdentifier:(id)identifier atPoint:(CGPoint)p { 71 | 72 | NSLog(@"%@", NSStringFromCGPoint(p)); 73 | 74 | // UIView *view = (UIView *)item; 75 | // view.backgroundColor = [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]; 76 | 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /UIDynamicTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // UIDynamicTest 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. 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 | -------------------------------------------------------------------------------- /UIDynamicTestTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /UIDynamicTestTests/UIDynamicTestTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIDynamicTestTests.m 3 | // UIDynamicTestTests 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIDynamicTestTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation UIDynamicTestTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /UIDynamicTestUITests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /UIDynamicTestUITests/UIDynamicTestUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIDynamicTestUITests.m 3 | // UIDynamicTestUITests 4 | // 5 | // Created by Macx on 2017/9/5. 6 | // Copyright © 2017年 wt. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIDynamicTestUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation UIDynamicTestUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutao66/UIDynamicTest/2769938b8746ad8d955778cf7a461319eed167e4/test.gif --------------------------------------------------------------------------------