├── 02-多物理仿真 ├── 02-多物理仿真.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── wangpengfei.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── wangpengfei.xcuserdatad │ │ └── xcschemes │ │ ├── 02-多物理仿真.xcscheme │ │ └── xcschememanagement.plist ├── 02-多物理仿真 │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── AttachmentPoint_Mask.imageset │ │ │ ├── AttachmentPoint_Mask@2x.png │ │ │ └── Contents.json │ │ ├── BackgroundTile.imageset │ │ │ ├── BackgroundTile@2x.png │ │ │ └── Contents.json │ │ ├── Box1.imageset │ │ │ ├── Box1@2x.png │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ ├── WPFAttachmentView.h │ ├── WPFAttachmentView.m │ ├── WPFBaseView.h │ ├── WPFBaseView.m │ ├── WPFCollisionView.h │ ├── WPFCollisionView.m │ ├── WPFDemoController.h │ ├── WPFDemoController.m │ ├── WPFPushView.h │ ├── WPFPushView.m │ ├── WPFSnapView.h │ ├── WPFSnapView.m │ ├── WPFSpringView.h │ ├── WPFSpringView.m │ └── main.m ├── 02-多物理仿真Tests │ ├── Info.plist │ └── _2______Tests.m └── 02-多物理仿真UITests │ ├── Info.plist │ └── _2______UITests.m └── 03-多对象的附着行为 ├── 03-多对象的附着行为.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── wangpengfei.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── wangpengfei.xcuserdatad │ └── xcschemes │ ├── 03-多对象的附着行为.xcscheme │ └── xcschememanagement.plist ├── 03-多对象的附着行为 ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── 03-多对象的附着行为Tests ├── Info.plist └── _3_________Tests.m └── 03-多对象的附着行为UITests ├── Info.plist └── _3_________UITests.m /02-多物理仿真/02-多物理仿真.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0F190A771C420657004C387B /* WPFSnapView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F190A761C420657004C387B /* WPFSnapView.m */; }; 11 | 0F190A7A1C420667004C387B /* WPFPushView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F190A791C420667004C387B /* WPFPushView.m */; }; 12 | 0F190A7D1C42067C004C387B /* WPFAttachmentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F190A7C1C42067C004C387B /* WPFAttachmentView.m */; }; 13 | 0F190A801C42068C004C387B /* WPFSpringView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F190A7F1C42068C004C387B /* WPFSpringView.m */; }; 14 | 0F190A831C42069E004C387B /* WPFCollisionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F190A821C42069E004C387B /* WPFCollisionView.m */; }; 15 | 0F640DED1C412F5A003981CE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F640DEC1C412F5A003981CE /* main.m */; }; 16 | 0F640DF01C412F5A003981CE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F640DEF1C412F5A003981CE /* AppDelegate.m */; }; 17 | 0F640DF31C412F5A003981CE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F640DF21C412F5A003981CE /* ViewController.m */; }; 18 | 0F640DF61C412F5A003981CE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F640DF41C412F5A003981CE /* Main.storyboard */; }; 19 | 0F640DF81C412F5A003981CE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0F640DF71C412F5A003981CE /* Assets.xcassets */; }; 20 | 0F640DFB1C412F5A003981CE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F640DF91C412F5A003981CE /* LaunchScreen.storyboard */; }; 21 | 0F640E061C412F5A003981CE /* _2______Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F640E051C412F5A003981CE /* _2______Tests.m */; }; 22 | 0F640E111C412F5A003981CE /* _2______UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F640E101C412F5A003981CE /* _2______UITests.m */; }; 23 | 0F640E231C413479003981CE /* WPFBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F640E221C413479003981CE /* WPFBaseView.m */; }; 24 | 0FDED2531C41FBF000F30810 /* WPFDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FDED2521C41FBF000F30810 /* WPFDemoController.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 0F640E021C412F5A003981CE /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 0F640DE01C412F5A003981CE /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 0F640DE71C412F5A003981CE; 33 | remoteInfo = "02-多物理仿真"; 34 | }; 35 | 0F640E0D1C412F5A003981CE /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 0F640DE01C412F5A003981CE /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = 0F640DE71C412F5A003981CE; 40 | remoteInfo = "02-多物理仿真"; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 0F190A751C420657004C387B /* WPFSnapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFSnapView.h; sourceTree = ""; }; 46 | 0F190A761C420657004C387B /* WPFSnapView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFSnapView.m; sourceTree = ""; }; 47 | 0F190A781C420667004C387B /* WPFPushView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFPushView.h; sourceTree = ""; }; 48 | 0F190A791C420667004C387B /* WPFPushView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFPushView.m; sourceTree = ""; }; 49 | 0F190A7B1C42067C004C387B /* WPFAttachmentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFAttachmentView.h; sourceTree = ""; }; 50 | 0F190A7C1C42067C004C387B /* WPFAttachmentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFAttachmentView.m; sourceTree = ""; }; 51 | 0F190A7E1C42068C004C387B /* WPFSpringView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFSpringView.h; sourceTree = ""; }; 52 | 0F190A7F1C42068C004C387B /* WPFSpringView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFSpringView.m; sourceTree = ""; }; 53 | 0F190A811C42069E004C387B /* WPFCollisionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFCollisionView.h; sourceTree = ""; }; 54 | 0F190A821C42069E004C387B /* WPFCollisionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFCollisionView.m; sourceTree = ""; }; 55 | 0F640DE81C412F5A003981CE /* 02-多物理仿真.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "02-多物理仿真.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 0F640DEC1C412F5A003981CE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 57 | 0F640DEE1C412F5A003981CE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 58 | 0F640DEF1C412F5A003981CE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 59 | 0F640DF11C412F5A003981CE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 60 | 0F640DF21C412F5A003981CE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 61 | 0F640DF51C412F5A003981CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 62 | 0F640DF71C412F5A003981CE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 63 | 0F640DFA1C412F5A003981CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 64 | 0F640DFC1C412F5A003981CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 65 | 0F640E011C412F5A003981CE /* 02-多物理仿真Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "02-多物理仿真Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 66 | 0F640E051C412F5A003981CE /* _2______Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "_2______Tests.m"; sourceTree = ""; }; 67 | 0F640E071C412F5A003981CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 68 | 0F640E0C1C412F5A003981CE /* 02-多物理仿真UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "02-多物理仿真UITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 69 | 0F640E101C412F5A003981CE /* _2______UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "_2______UITests.m"; sourceTree = ""; }; 70 | 0F640E121C412F5B003981CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 71 | 0F640E211C413479003981CE /* WPFBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFBaseView.h; sourceTree = ""; }; 72 | 0F640E221C413479003981CE /* WPFBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFBaseView.m; sourceTree = ""; }; 73 | 0FDED2511C41FBF000F30810 /* WPFDemoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPFDemoController.h; sourceTree = ""; }; 74 | 0FDED2521C41FBF000F30810 /* WPFDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPFDemoController.m; sourceTree = ""; }; 75 | /* End PBXFileReference section */ 76 | 77 | /* Begin PBXFrameworksBuildPhase section */ 78 | 0F640DE51C412F5A003981CE /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | 0F640DFE1C412F5A003981CE /* Frameworks */ = { 86 | isa = PBXFrameworksBuildPhase; 87 | buildActionMask = 2147483647; 88 | files = ( 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | 0F640E091C412F5A003981CE /* Frameworks */ = { 93 | isa = PBXFrameworksBuildPhase; 94 | buildActionMask = 2147483647; 95 | files = ( 96 | ); 97 | runOnlyForDeploymentPostprocessing = 0; 98 | }; 99 | /* End PBXFrameworksBuildPhase section */ 100 | 101 | /* Begin PBXGroup section */ 102 | 0F640DDF1C412F5A003981CE = { 103 | isa = PBXGroup; 104 | children = ( 105 | 0F640DEA1C412F5A003981CE /* 02-多物理仿真 */, 106 | 0F640E041C412F5A003981CE /* 02-多物理仿真Tests */, 107 | 0F640E0F1C412F5A003981CE /* 02-多物理仿真UITests */, 108 | 0F640DE91C412F5A003981CE /* Products */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 0F640DE91C412F5A003981CE /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 0F640DE81C412F5A003981CE /* 02-多物理仿真.app */, 116 | 0F640E011C412F5A003981CE /* 02-多物理仿真Tests.xctest */, 117 | 0F640E0C1C412F5A003981CE /* 02-多物理仿真UITests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 0F640DEA1C412F5A003981CE /* 02-多物理仿真 */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 0F640E1F1C412F90003981CE /* View */, 126 | 0F640E201C412F95003981CE /* Controller */, 127 | 0F640E1E1C412F8B003981CE /* Other */, 128 | 0F640DEB1C412F5A003981CE /* Supporting Files */, 129 | ); 130 | path = "02-多物理仿真"; 131 | sourceTree = ""; 132 | }; 133 | 0F640DEB1C412F5A003981CE /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 0F640DF71C412F5A003981CE /* Assets.xcassets */, 137 | 0F640DF91C412F5A003981CE /* LaunchScreen.storyboard */, 138 | 0F640DFC1C412F5A003981CE /* Info.plist */, 139 | 0F640DEC1C412F5A003981CE /* main.m */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | 0F640E041C412F5A003981CE /* 02-多物理仿真Tests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 0F640E051C412F5A003981CE /* _2______Tests.m */, 148 | 0F640E071C412F5A003981CE /* Info.plist */, 149 | ); 150 | path = "02-多物理仿真Tests"; 151 | sourceTree = ""; 152 | }; 153 | 0F640E0F1C412F5A003981CE /* 02-多物理仿真UITests */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 0F640E101C412F5A003981CE /* _2______UITests.m */, 157 | 0F640E121C412F5B003981CE /* Info.plist */, 158 | ); 159 | path = "02-多物理仿真UITests"; 160 | sourceTree = ""; 161 | }; 162 | 0F640E1E1C412F8B003981CE /* Other */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 0F640DEE1C412F5A003981CE /* AppDelegate.h */, 166 | 0F640DEF1C412F5A003981CE /* AppDelegate.m */, 167 | ); 168 | name = Other; 169 | sourceTree = ""; 170 | }; 171 | 0F640E1F1C412F90003981CE /* View */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 0F640E211C413479003981CE /* WPFBaseView.h */, 175 | 0F640E221C413479003981CE /* WPFBaseView.m */, 176 | 0F190A751C420657004C387B /* WPFSnapView.h */, 177 | 0F190A761C420657004C387B /* WPFSnapView.m */, 178 | 0F190A781C420667004C387B /* WPFPushView.h */, 179 | 0F190A791C420667004C387B /* WPFPushView.m */, 180 | 0F190A7B1C42067C004C387B /* WPFAttachmentView.h */, 181 | 0F190A7C1C42067C004C387B /* WPFAttachmentView.m */, 182 | 0F190A7E1C42068C004C387B /* WPFSpringView.h */, 183 | 0F190A7F1C42068C004C387B /* WPFSpringView.m */, 184 | 0F190A811C42069E004C387B /* WPFCollisionView.h */, 185 | 0F190A821C42069E004C387B /* WPFCollisionView.m */, 186 | ); 187 | name = View; 188 | sourceTree = ""; 189 | }; 190 | 0F640E201C412F95003981CE /* Controller */ = { 191 | isa = PBXGroup; 192 | children = ( 193 | 0F640DF11C412F5A003981CE /* ViewController.h */, 194 | 0F640DF21C412F5A003981CE /* ViewController.m */, 195 | 0F640DF41C412F5A003981CE /* Main.storyboard */, 196 | 0FDED2511C41FBF000F30810 /* WPFDemoController.h */, 197 | 0FDED2521C41FBF000F30810 /* WPFDemoController.m */, 198 | ); 199 | name = Controller; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXGroup section */ 203 | 204 | /* Begin PBXNativeTarget section */ 205 | 0F640DE71C412F5A003981CE /* 02-多物理仿真 */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 0F640E151C412F5B003981CE /* Build configuration list for PBXNativeTarget "02-多物理仿真" */; 208 | buildPhases = ( 209 | 0F640DE41C412F5A003981CE /* Sources */, 210 | 0F640DE51C412F5A003981CE /* Frameworks */, 211 | 0F640DE61C412F5A003981CE /* Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | ); 217 | name = "02-多物理仿真"; 218 | productName = "02-多物理仿真"; 219 | productReference = 0F640DE81C412F5A003981CE /* 02-多物理仿真.app */; 220 | productType = "com.apple.product-type.application"; 221 | }; 222 | 0F640E001C412F5A003981CE /* 02-多物理仿真Tests */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 0F640E181C412F5B003981CE /* Build configuration list for PBXNativeTarget "02-多物理仿真Tests" */; 225 | buildPhases = ( 226 | 0F640DFD1C412F5A003981CE /* Sources */, 227 | 0F640DFE1C412F5A003981CE /* Frameworks */, 228 | 0F640DFF1C412F5A003981CE /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | 0F640E031C412F5A003981CE /* PBXTargetDependency */, 234 | ); 235 | name = "02-多物理仿真Tests"; 236 | productName = "02-多物理仿真Tests"; 237 | productReference = 0F640E011C412F5A003981CE /* 02-多物理仿真Tests.xctest */; 238 | productType = "com.apple.product-type.bundle.unit-test"; 239 | }; 240 | 0F640E0B1C412F5A003981CE /* 02-多物理仿真UITests */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = 0F640E1B1C412F5B003981CE /* Build configuration list for PBXNativeTarget "02-多物理仿真UITests" */; 243 | buildPhases = ( 244 | 0F640E081C412F5A003981CE /* Sources */, 245 | 0F640E091C412F5A003981CE /* Frameworks */, 246 | 0F640E0A1C412F5A003981CE /* Resources */, 247 | ); 248 | buildRules = ( 249 | ); 250 | dependencies = ( 251 | 0F640E0E1C412F5A003981CE /* PBXTargetDependency */, 252 | ); 253 | name = "02-多物理仿真UITests"; 254 | productName = "02-多物理仿真UITests"; 255 | productReference = 0F640E0C1C412F5A003981CE /* 02-多物理仿真UITests.xctest */; 256 | productType = "com.apple.product-type.bundle.ui-testing"; 257 | }; 258 | /* End PBXNativeTarget section */ 259 | 260 | /* Begin PBXProject section */ 261 | 0F640DE01C412F5A003981CE /* Project object */ = { 262 | isa = PBXProject; 263 | attributes = { 264 | LastUpgradeCheck = 0710; 265 | ORGANIZATIONNAME = "王鹏飞"; 266 | TargetAttributes = { 267 | 0F640DE71C412F5A003981CE = { 268 | CreatedOnToolsVersion = 7.1; 269 | }; 270 | 0F640E001C412F5A003981CE = { 271 | CreatedOnToolsVersion = 7.1; 272 | TestTargetID = 0F640DE71C412F5A003981CE; 273 | }; 274 | 0F640E0B1C412F5A003981CE = { 275 | CreatedOnToolsVersion = 7.1; 276 | TestTargetID = 0F640DE71C412F5A003981CE; 277 | }; 278 | }; 279 | }; 280 | buildConfigurationList = 0F640DE31C412F5A003981CE /* Build configuration list for PBXProject "02-多物理仿真" */; 281 | compatibilityVersion = "Xcode 3.2"; 282 | developmentRegion = English; 283 | hasScannedForEncodings = 0; 284 | knownRegions = ( 285 | en, 286 | Base, 287 | ); 288 | mainGroup = 0F640DDF1C412F5A003981CE; 289 | productRefGroup = 0F640DE91C412F5A003981CE /* Products */; 290 | projectDirPath = ""; 291 | projectRoot = ""; 292 | targets = ( 293 | 0F640DE71C412F5A003981CE /* 02-多物理仿真 */, 294 | 0F640E001C412F5A003981CE /* 02-多物理仿真Tests */, 295 | 0F640E0B1C412F5A003981CE /* 02-多物理仿真UITests */, 296 | ); 297 | }; 298 | /* End PBXProject section */ 299 | 300 | /* Begin PBXResourcesBuildPhase section */ 301 | 0F640DE61C412F5A003981CE /* Resources */ = { 302 | isa = PBXResourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 0F640DFB1C412F5A003981CE /* LaunchScreen.storyboard in Resources */, 306 | 0F640DF81C412F5A003981CE /* Assets.xcassets in Resources */, 307 | 0F640DF61C412F5A003981CE /* Main.storyboard in Resources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | 0F640DFF1C412F5A003981CE /* Resources */ = { 312 | isa = PBXResourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | }; 318 | 0F640E0A1C412F5A003981CE /* Resources */ = { 319 | isa = PBXResourcesBuildPhase; 320 | buildActionMask = 2147483647; 321 | files = ( 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | }; 325 | /* End PBXResourcesBuildPhase section */ 326 | 327 | /* Begin PBXSourcesBuildPhase section */ 328 | 0F640DE41C412F5A003981CE /* Sources */ = { 329 | isa = PBXSourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | 0F640DF31C412F5A003981CE /* ViewController.m in Sources */, 333 | 0FDED2531C41FBF000F30810 /* WPFDemoController.m in Sources */, 334 | 0F640DF01C412F5A003981CE /* AppDelegate.m in Sources */, 335 | 0F190A801C42068C004C387B /* WPFSpringView.m in Sources */, 336 | 0F640DED1C412F5A003981CE /* main.m in Sources */, 337 | 0F190A771C420657004C387B /* WPFSnapView.m in Sources */, 338 | 0F640E231C413479003981CE /* WPFBaseView.m in Sources */, 339 | 0F190A7A1C420667004C387B /* WPFPushView.m in Sources */, 340 | 0F190A7D1C42067C004C387B /* WPFAttachmentView.m in Sources */, 341 | 0F190A831C42069E004C387B /* WPFCollisionView.m in Sources */, 342 | ); 343 | runOnlyForDeploymentPostprocessing = 0; 344 | }; 345 | 0F640DFD1C412F5A003981CE /* Sources */ = { 346 | isa = PBXSourcesBuildPhase; 347 | buildActionMask = 2147483647; 348 | files = ( 349 | 0F640E061C412F5A003981CE /* _2______Tests.m in Sources */, 350 | ); 351 | runOnlyForDeploymentPostprocessing = 0; 352 | }; 353 | 0F640E081C412F5A003981CE /* Sources */ = { 354 | isa = PBXSourcesBuildPhase; 355 | buildActionMask = 2147483647; 356 | files = ( 357 | 0F640E111C412F5A003981CE /* _2______UITests.m in Sources */, 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | }; 361 | /* End PBXSourcesBuildPhase section */ 362 | 363 | /* Begin PBXTargetDependency section */ 364 | 0F640E031C412F5A003981CE /* PBXTargetDependency */ = { 365 | isa = PBXTargetDependency; 366 | target = 0F640DE71C412F5A003981CE /* 02-多物理仿真 */; 367 | targetProxy = 0F640E021C412F5A003981CE /* PBXContainerItemProxy */; 368 | }; 369 | 0F640E0E1C412F5A003981CE /* PBXTargetDependency */ = { 370 | isa = PBXTargetDependency; 371 | target = 0F640DE71C412F5A003981CE /* 02-多物理仿真 */; 372 | targetProxy = 0F640E0D1C412F5A003981CE /* PBXContainerItemProxy */; 373 | }; 374 | /* End PBXTargetDependency section */ 375 | 376 | /* Begin PBXVariantGroup section */ 377 | 0F640DF41C412F5A003981CE /* Main.storyboard */ = { 378 | isa = PBXVariantGroup; 379 | children = ( 380 | 0F640DF51C412F5A003981CE /* Base */, 381 | ); 382 | name = Main.storyboard; 383 | sourceTree = ""; 384 | }; 385 | 0F640DF91C412F5A003981CE /* LaunchScreen.storyboard */ = { 386 | isa = PBXVariantGroup; 387 | children = ( 388 | 0F640DFA1C412F5A003981CE /* Base */, 389 | ); 390 | name = LaunchScreen.storyboard; 391 | sourceTree = ""; 392 | }; 393 | /* End PBXVariantGroup section */ 394 | 395 | /* Begin XCBuildConfiguration section */ 396 | 0F640E131C412F5B003981CE /* Debug */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ALWAYS_SEARCH_USER_PATHS = NO; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_WARN_BOOL_CONVERSION = YES; 405 | CLANG_WARN_CONSTANT_CONVERSION = YES; 406 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 407 | CLANG_WARN_EMPTY_BODY = YES; 408 | CLANG_WARN_ENUM_CONVERSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = dwarf; 416 | ENABLE_STRICT_OBJC_MSGSEND = YES; 417 | ENABLE_TESTABILITY = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_DYNAMIC_NO_PIC = NO; 420 | GCC_NO_COMMON_BLOCKS = YES; 421 | GCC_OPTIMIZATION_LEVEL = 0; 422 | GCC_PREPROCESSOR_DEFINITIONS = ( 423 | "DEBUG=1", 424 | "$(inherited)", 425 | ); 426 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 427 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 428 | GCC_WARN_UNDECLARED_SELECTOR = YES; 429 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 430 | GCC_WARN_UNUSED_FUNCTION = YES; 431 | GCC_WARN_UNUSED_VARIABLE = YES; 432 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 433 | MTL_ENABLE_DEBUG_INFO = YES; 434 | ONLY_ACTIVE_ARCH = YES; 435 | SDKROOT = iphoneos; 436 | }; 437 | name = Debug; 438 | }; 439 | 0F640E141C412F5B003981CE /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | ALWAYS_SEARCH_USER_PATHS = NO; 443 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 444 | CLANG_CXX_LIBRARY = "libc++"; 445 | CLANG_ENABLE_MODULES = YES; 446 | CLANG_ENABLE_OBJC_ARC = YES; 447 | CLANG_WARN_BOOL_CONVERSION = YES; 448 | CLANG_WARN_CONSTANT_CONVERSION = YES; 449 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 450 | CLANG_WARN_EMPTY_BODY = YES; 451 | CLANG_WARN_ENUM_CONVERSION = YES; 452 | CLANG_WARN_INT_CONVERSION = YES; 453 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 454 | CLANG_WARN_UNREACHABLE_CODE = YES; 455 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 456 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 457 | COPY_PHASE_STRIP = NO; 458 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 459 | ENABLE_NS_ASSERTIONS = NO; 460 | ENABLE_STRICT_OBJC_MSGSEND = YES; 461 | GCC_C_LANGUAGE_STANDARD = gnu99; 462 | GCC_NO_COMMON_BLOCKS = YES; 463 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 464 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 465 | GCC_WARN_UNDECLARED_SELECTOR = YES; 466 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 467 | GCC_WARN_UNUSED_FUNCTION = YES; 468 | GCC_WARN_UNUSED_VARIABLE = YES; 469 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 470 | MTL_ENABLE_DEBUG_INFO = NO; 471 | SDKROOT = iphoneos; 472 | VALIDATE_PRODUCT = YES; 473 | }; 474 | name = Release; 475 | }; 476 | 0F640E161C412F5B003981CE /* Debug */ = { 477 | isa = XCBuildConfiguration; 478 | buildSettings = { 479 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 480 | INFOPLIST_FILE = "02-多物理仿真/Info.plist"; 481 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 482 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-2------"; 483 | PRODUCT_NAME = "$(TARGET_NAME)"; 484 | }; 485 | name = Debug; 486 | }; 487 | 0F640E171C412F5B003981CE /* Release */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 491 | INFOPLIST_FILE = "02-多物理仿真/Info.plist"; 492 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 493 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-2------"; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | }; 496 | name = Release; 497 | }; 498 | 0F640E191C412F5B003981CE /* Debug */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | BUNDLE_LOADER = "$(TEST_HOST)"; 502 | INFOPLIST_FILE = "02-多物理仿真Tests/Info.plist"; 503 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 504 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-2------Tests"; 505 | PRODUCT_NAME = "$(TARGET_NAME)"; 506 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/02-多物理仿真.app/02-多物理仿真"; 507 | }; 508 | name = Debug; 509 | }; 510 | 0F640E1A1C412F5B003981CE /* Release */ = { 511 | isa = XCBuildConfiguration; 512 | buildSettings = { 513 | BUNDLE_LOADER = "$(TEST_HOST)"; 514 | INFOPLIST_FILE = "02-多物理仿真Tests/Info.plist"; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 516 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-2------Tests"; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/02-多物理仿真.app/02-多物理仿真"; 519 | }; 520 | name = Release; 521 | }; 522 | 0F640E1C1C412F5B003981CE /* Debug */ = { 523 | isa = XCBuildConfiguration; 524 | buildSettings = { 525 | INFOPLIST_FILE = "02-多物理仿真UITests/Info.plist"; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 527 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-2------UITests"; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | TEST_TARGET_NAME = "02-多物理仿真"; 530 | USES_XCTRUNNER = YES; 531 | }; 532 | name = Debug; 533 | }; 534 | 0F640E1D1C412F5B003981CE /* Release */ = { 535 | isa = XCBuildConfiguration; 536 | buildSettings = { 537 | INFOPLIST_FILE = "02-多物理仿真UITests/Info.plist"; 538 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 539 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-2------UITests"; 540 | PRODUCT_NAME = "$(TARGET_NAME)"; 541 | TEST_TARGET_NAME = "02-多物理仿真"; 542 | USES_XCTRUNNER = YES; 543 | }; 544 | name = Release; 545 | }; 546 | /* End XCBuildConfiguration section */ 547 | 548 | /* Begin XCConfigurationList section */ 549 | 0F640DE31C412F5A003981CE /* Build configuration list for PBXProject "02-多物理仿真" */ = { 550 | isa = XCConfigurationList; 551 | buildConfigurations = ( 552 | 0F640E131C412F5B003981CE /* Debug */, 553 | 0F640E141C412F5B003981CE /* Release */, 554 | ); 555 | defaultConfigurationIsVisible = 0; 556 | defaultConfigurationName = Release; 557 | }; 558 | 0F640E151C412F5B003981CE /* Build configuration list for PBXNativeTarget "02-多物理仿真" */ = { 559 | isa = XCConfigurationList; 560 | buildConfigurations = ( 561 | 0F640E161C412F5B003981CE /* Debug */, 562 | 0F640E171C412F5B003981CE /* Release */, 563 | ); 564 | defaultConfigurationIsVisible = 0; 565 | defaultConfigurationName = Release; 566 | }; 567 | 0F640E181C412F5B003981CE /* Build configuration list for PBXNativeTarget "02-多物理仿真Tests" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | 0F640E191C412F5B003981CE /* Debug */, 571 | 0F640E1A1C412F5B003981CE /* Release */, 572 | ); 573 | defaultConfigurationIsVisible = 0; 574 | defaultConfigurationName = Release; 575 | }; 576 | 0F640E1B1C412F5B003981CE /* Build configuration list for PBXNativeTarget "02-多物理仿真UITests" */ = { 577 | isa = XCConfigurationList; 578 | buildConfigurations = ( 579 | 0F640E1C1C412F5B003981CE /* Debug */, 580 | 0F640E1D1C412F5B003981CE /* Release */, 581 | ); 582 | defaultConfigurationIsVisible = 0; 583 | defaultConfigurationName = Release; 584 | }; 585 | /* End XCConfigurationList section */ 586 | }; 587 | rootObject = 0F640DE01C412F5A003981CE /* Project object */; 588 | } 589 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真.xcodeproj/project.xcworkspace/xcuserdata/wangpengfei.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PengfeiWang666/UIDynamic-/a10cba766c97bce10b20c235eb1cbaae52c55e95/02-多物理仿真/02-多物理仿真.xcodeproj/project.xcworkspace/xcuserdata/wangpengfei.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真.xcodeproj/xcuserdata/wangpengfei.xcuserdatad/xcschemes/02-多物理仿真.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 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真.xcodeproj/xcuserdata/wangpengfei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 02-多物理仿真.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 0F640DE71C412F5A003981CE 16 | 17 | primary 18 | 19 | 20 | 0F640E001C412F5A003981CE 21 | 22 | primary 23 | 24 | 25 | 0F640E0B1C412F5A003981CE 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. 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 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/AttachmentPoint_Mask.imageset/AttachmentPoint_Mask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PengfeiWang666/UIDynamic-/a10cba766c97bce10b20c235eb1cbaae52c55e95/02-多物理仿真/02-多物理仿真/Assets.xcassets/AttachmentPoint_Mask.imageset/AttachmentPoint_Mask@2x.png -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/AttachmentPoint_Mask.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "AttachmentPoint_Mask@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/BackgroundTile.imageset/BackgroundTile@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PengfeiWang666/UIDynamic-/a10cba766c97bce10b20c235eb1cbaae52c55e95/02-多物理仿真/02-多物理仿真/Assets.xcassets/BackgroundTile.imageset/BackgroundTile@2x.png -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/BackgroundTile.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "BackgroundTile@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/Box1.imageset/Box1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PengfeiWang666/UIDynamic-/a10cba766c97bce10b20c235eb1cbaae52c55e95/02-多物理仿真/02-多物理仿真/Assets.xcassets/Box1.imageset/Box1@2x.png -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/Box1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Box1@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/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 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/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 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | 13 | @interface ViewController : UITableViewController 14 | 15 | 16 | 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "WPFDemoController.h" 11 | 12 | @interface ViewController () 13 | { 14 | NSArray *_dynamicArr; 15 | } 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | 25 | _dynamicArr = @[@"吸附行为", @"推动行为", @"刚性附着行为", @"弹性附着行为", @"碰撞检测"]; 26 | 27 | self.tableView.tableFooterView = [[UIView alloc] init]; 28 | 29 | 30 | 31 | } 32 | 33 | // 几组 34 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 35 | return 1; 36 | } 37 | 38 | // 几行 39 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 40 | return 5; 41 | } 42 | 43 | // 每行的具体内容 44 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 45 | 46 | // 1. 设置可重用id 47 | NSString *identifier = @"helloCell"; 48 | 49 | // 2. 根据可重用id 去tableView 的缓存区去找 50 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 51 | 52 | // 3. 如果找不到,就重新实例化一个 53 | if (nil == cell) { 54 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 55 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 56 | } 57 | 58 | cell.textLabel.text = _dynamicArr[indexPath.row]; 59 | 60 | return cell; 61 | } 62 | 63 | // 执行代理方法 64 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 65 | 66 | // 1. 实例化一个仿真管理器 67 | WPFDemoController *demoVc = [[WPFDemoController alloc] init]; 68 | 69 | // 2. 设置标题 70 | demoVc.title = _dynamicArr[indexPath.row]; 71 | 72 | // 3. 传递功能类型 73 | demoVc.function = (int)indexPath.row; 74 | 75 | // 4. 跳转界面 76 | [self.navigationController pushViewController:demoVc animated:YES]; 77 | 78 | } 79 | 80 | 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFAttachmentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFAttachmentView.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFBaseView.h" 10 | 11 | @interface WPFAttachmentView : WPFBaseView 12 | 13 | @property (nonatomic, strong) UIAttachmentBehavior *attachment; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFAttachmentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFAttachmentView.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFAttachmentView.h" 10 | 11 | @interface WPFAttachmentView () 12 | { 13 | // 附着点图片框 14 | UIImageView *_anchorImgView; 15 | 16 | // 参考点图片框(boxView 内部) 17 | UIImageView *_offsetImgView; 18 | } 19 | @end 20 | 21 | @implementation WPFAttachmentView 22 | 23 | - (instancetype)init { 24 | if (self = [super init]) { 25 | 26 | // 1. 设置boxView 的中心点 27 | self.boxView.center = CGPointMake(200, 200); 28 | 29 | // 2. 添加附着点 30 | CGPoint anchorPoint = CGPointMake(200, 100); 31 | UIOffset offset = UIOffsetMake(20, 20); 32 | 33 | // 3. 添加附着行为 34 | UIAttachmentBehavior *attachment = [[UIAttachmentBehavior alloc] initWithItem:self.boxView offsetFromCenter:offset attachedToAnchor:anchorPoint]; 35 | 36 | [self.animator addBehavior:attachment]; 37 | self.attachment = attachment; 38 | 39 | // 4. 设置附着点图片(即直杆与被拖拽图片的连接点) 40 | UIImage *image = [UIImage imageNamed:@"AttachmentPoint_Mask"]; 41 | UIImageView *anchorImgView = [[UIImageView alloc] initWithImage:image]; 42 | anchorImgView.center = anchorPoint; 43 | 44 | [self addSubview:anchorImgView]; 45 | _anchorImgView = anchorImgView; 46 | 47 | // 3. 设置参考点 48 | _offsetImgView = [[UIImageView alloc] initWithImage:image]; 49 | 50 | CGFloat x = self.boxView.bounds.size.width * 0.5 + offset.horizontal; 51 | CGFloat y = self.boxView.bounds.size.height * 0.5 + offset.vertical; 52 | _offsetImgView.center = CGPointMake(x, y); 53 | [self.boxView addSubview:_offsetImgView]; 54 | 55 | // 4. 增加拖拽手势 56 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)]; 57 | [self addGestureRecognizer:pan]; 58 | } 59 | return self; 60 | } 61 | 62 | // 拖拽的时候会调用的方法 63 | - (void)panAction:(UIPanGestureRecognizer *)pan { 64 | 65 | // 1. 获取触摸点 66 | CGPoint loc = [pan locationInView:self]; 67 | 68 | 69 | // 2. 修改附着行为的附着点 70 | _anchorImgView.center = loc; 71 | self.attachment.anchorPoint = loc; 72 | 73 | // 3. 进行重绘 74 | [self setNeedsDisplay]; 75 | } 76 | 77 | 78 | - (void)drawRect:(CGRect)rect { 79 | 80 | // 1. 获取路径 81 | UIBezierPath *bezierPath = [UIBezierPath bezierPath]; 82 | 83 | // 2. 划线 84 | [bezierPath moveToPoint:_anchorImgView.center]; 85 | 86 | CGPoint p = [self convertPoint:_offsetImgView.center fromView:self.boxView]; 87 | [bezierPath addLineToPoint:p]; 88 | 89 | bezierPath.lineWidth = 6; 90 | 91 | // 3. 渲染 92 | [bezierPath stroke]; 93 | 94 | } 95 | 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFBaseView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFBaseView.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WPFBaseView : UIView 12 | 13 | /** 方块视图 */ 14 | @property (nonatomic, weak) UIImageView *boxView; 15 | 16 | /** 仿真者 */ 17 | @property (nonatomic, strong) UIDynamicAnimator *animator; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFBaseView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFBaseView.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFBaseView.h" 10 | 11 | @implementation WPFBaseView 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame { 14 | 15 | if (self = [super initWithFrame:frame]) { 16 | // 设置背景 17 | self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"BackgroundTile"]]; 18 | 19 | // 设置方块 20 | UIImageView *boxView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Box1"]]; 21 | boxView.center = CGPointMake(200, 220); 22 | [self addSubview:boxView]; 23 | self.boxView = boxView; 24 | 25 | // 初始化仿真者 26 | UIDynamicAnimator *animator = [[UIDynamicAnimator alloc] initWithReferenceView:self]; 27 | 28 | self.animator = animator; 29 | } 30 | 31 | return self; 32 | 33 | } 34 | 35 | 36 | 37 | /* 38 | // Only override drawRect: if you perform custom drawing. 39 | // An empty implementation adversely affects performance during animation. 40 | - (void)drawRect:(CGRect)rect { 41 | // Drawing code 42 | } 43 | */ 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFCollisionView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFCollisionView.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFBaseView.h" 10 | 11 | @interface WPFCollisionView : WPFBaseView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFCollisionView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFCollisionView.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFCollisionView.h" 10 | 11 | @interface WPFCollisionView () 12 | 13 | @end 14 | 15 | @implementation WPFCollisionView 16 | 17 | - (instancetype)init { 18 | 19 | if (self = [super init]) { 20 | 21 | 22 | self.boxView.center = CGPointMake(190, 0); 23 | 24 | // 1. 添加重力行为 25 | UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:@[self.boxView]]; 26 | 27 | [self.animator addBehavior:gravity]; 28 | 29 | // 2. 边缘检测 30 | // 如果把红色view 也加边缘检测,则碰撞后红色View 也会被碰掉,因此要手动添加边界 31 | UICollisionBehavior *collision = [[UICollisionBehavior alloc] initWithItems:@[self.boxView]]; 32 | // 让碰撞的行为生效 33 | collision.translatesReferenceBoundsIntoBoundary = YES; 34 | 35 | collision.collisionDelegate = self; 36 | 37 | 38 | // 3. 添加一个红色view 39 | UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, 350, 180, 30)]; 40 | redView.backgroundColor = [UIColor redColor]; 41 | [self addSubview:redView]; 42 | 43 | 44 | // 4. 手动添加边界 45 | UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRect:redView.frame]; 46 | 47 | [collision addBoundaryWithIdentifier:@"redBoundary" forPath:bezierPath]; 48 | 49 | [self.animator addBehavior:collision]; 50 | 51 | // 5. 物体的属性行为 52 | UIDynamicItemBehavior *item = [[UIDynamicItemBehavior alloc] initWithItems:@[self.boxView]]; 53 | 54 | // 设置物体弹性,振幅 55 | item.elasticity = 0.8; 56 | [self.animator addBehavior:item]; 57 | } 58 | return self; 59 | } 60 | 61 | 62 | #pragma mark - UICollisionBehaviorDelegate 63 | // 在碰撞的时候调用 64 | - (void)collisionBehavior:(UICollisionBehavior *)behavior beganContactForItem:(id)item withBoundaryIdentifier:(id)identifier atPoint:(CGPoint)p { 65 | 66 | NSLog(@"%@", NSStringFromCGPoint(p)); 67 | 68 | // UIView *view = (UIView *)item; 69 | // view.backgroundColor = [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]; 70 | 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFDemoController.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | 13 | kDemoFunctionSnap = 0, 14 | kDemoFunctionPush, 15 | kDemoFunctionAttachment, 16 | kDemoFunctionSpring, 17 | kDemoFunctionCollision 18 | 19 | } kDemoFunction; 20 | 21 | @interface WPFDemoController : UIViewController 22 | 23 | /** 功能类型 */ 24 | @property (nonatomic, assign) kDemoFunction function; 25 | @end 26 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFDemoController.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFDemoController.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFDemoController.h" 10 | #import "WPFSnapView.h" 11 | #import "WPFPushView.h" 12 | #import "WPFAttachmentView.h" 13 | #import "WPFSpringView.h" 14 | #import "WPFCollisionView.h" 15 | 16 | @interface WPFDemoController () 17 | 18 | @end 19 | 20 | @implementation WPFDemoController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | WPFBaseView *baseView = nil; 26 | 27 | // 根据不同的功能类型选择不同的视图 28 | // 运用了多态 29 | switch (self.function) { 30 | case kDemoFunctionSnap: 31 | baseView = [[WPFSnapView alloc] init]; 32 | break; 33 | 34 | case kDemoFunctionPush: 35 | baseView = [[WPFPushView alloc] init]; 36 | break; 37 | 38 | case kDemoFunctionAttachment: 39 | baseView = [[WPFAttachmentView alloc] init]; 40 | break; 41 | 42 | case kDemoFunctionSpring: 43 | baseView = [[WPFSpringView alloc] init]; 44 | break; 45 | 46 | case kDemoFunctionCollision: 47 | baseView = [[WPFCollisionView alloc] init]; 48 | break; 49 | 50 | default: 51 | break; 52 | } 53 | 54 | baseView.frame = self.view.bounds; 55 | 56 | [self.view addSubview:baseView]; 57 | 58 | } 59 | 60 | - (void)didReceiveMemoryWarning { 61 | [super didReceiveMemoryWarning]; 62 | // Dispose of any resources that can be recreated. 63 | } 64 | 65 | /* 66 | #pragma mark - Navigation 67 | 68 | // In a storyboard-based application, you will often want to do a little preparation before navigation 69 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 70 | // Get the new view controller using [segue destinationViewController]. 71 | // Pass the selected object to the new view controller. 72 | } 73 | */ 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFPushView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFPushView.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFBaseView.h" 10 | 11 | @interface WPFPushView : WPFBaseView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFPushView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFPushView.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFPushView.h" 10 | 11 | @interface WPFPushView () 12 | { 13 | UIImageView *_smallView; 14 | UIPushBehavior *_push; 15 | CGPoint _firstPoint; 16 | CGPoint _currentPoint; 17 | } 18 | 19 | @end 20 | 21 | @implementation WPFPushView 22 | 23 | // 重写init 方法 24 | - (instancetype)init { 25 | 26 | if (self = [super init]) { 27 | 28 | // 1. 添加蓝色view 29 | UIView *blueView = [[UIView alloc] initWithFrame:CGRectMake(150, 300, 20, 20)]; 30 | blueView.backgroundColor = [UIColor blueColor]; 31 | [self addSubview:blueView]; 32 | 33 | 34 | 35 | // 2. 添加图片框,拖拽起点 36 | UIImageView *smallView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AttachmentPoint_Mask"]]; 37 | smallView.hidden = YES; 38 | [self addSubview:smallView]; 39 | _smallView = smallView; 40 | 41 | // 3. 添加推动行为 42 | UIPushBehavior *push = [[UIPushBehavior alloc] initWithItems:@[self.boxView] mode:UIPushBehaviorModeInstantaneous]; 43 | [self.animator addBehavior:push]; 44 | _push = push; 45 | 46 | 47 | // 4. 增加碰撞检测 48 | UICollisionBehavior *collision = [[UICollisionBehavior alloc] initWithItems:@[blueView, self.boxView]]; 49 | collision.translatesReferenceBoundsIntoBoundary = YES; 50 | [self.animator addBehavior:collision]; 51 | 52 | // 5. 添加拖拽手势 53 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)]; 54 | [self addGestureRecognizer:pan]; 55 | 56 | } 57 | 58 | return self; 59 | } 60 | 61 | // 监听开始拖拽的方法 62 | - (void)panAction:(UIPanGestureRecognizer *)pan { 63 | 64 | // 如果是刚开始拖拽,则设置起点处的小圆球 65 | if (pan.state == UIGestureRecognizerStateBegan) { 66 | 67 | _firstPoint = [pan locationInView:self]; 68 | _smallView.center = _firstPoint; 69 | _smallView.hidden = NO; 70 | 71 | 72 | // 当前拖拽行为正在移动 73 | } else if (pan.state == UIGestureRecognizerStateChanged) { 74 | 75 | _currentPoint = [pan locationInView:self]; 76 | 77 | [self setNeedsDisplay]; 78 | 79 | 80 | // 当前拖拽行为结束 81 | } else if (pan.state == UIGestureRecognizerStateEnded){ 82 | 83 | 84 | 85 | // 1. 计算偏移量 86 | CGPoint offset = CGPointMake(_currentPoint.x - _firstPoint.x, _currentPoint.y - _firstPoint.y); 87 | 88 | // 2. 计算角度 89 | CGFloat angle = atan2(offset.y, offset.x); 90 | 91 | // 3. 计算距离 92 | CGFloat distance = hypot(offset.y, offset.x); 93 | 94 | // 4. 设置推动的大小、角度 95 | _push.magnitude = distance; 96 | _push.angle = angle; 97 | 98 | // 5. 使单次推行为有效 99 | _push.active = YES; 100 | 101 | // 6. 将拖拽的线隐藏 102 | _firstPoint = CGPointZero; 103 | _currentPoint = CGPointZero; 104 | 105 | // 2. 将起点的小圆隐藏 106 | _smallView.hidden = YES; 107 | [self setNeedsDisplay]; 108 | 109 | 110 | } 111 | 112 | 113 | } 114 | 115 | - (void)drawRect:(CGRect)rect { 116 | 117 | // 1. 开启上下文对象 118 | CGContextRef ctxRef = UIGraphicsGetCurrentContext(); 119 | 120 | // 2 创建路径对象 121 | 122 | CGContextMoveToPoint(ctxRef, _firstPoint.x, _firstPoint.y); 123 | CGContextAddLineToPoint(ctxRef, _currentPoint.x, _currentPoint.y); 124 | 125 | // 3. 设置线宽和颜色 126 | CGContextSetLineWidth(ctxRef, 10); 127 | CGContextSetLineJoin(ctxRef, kCGLineJoinRound); 128 | CGContextSetLineCap(ctxRef, kCGLineCapRound); 129 | [[UIColor colorWithRed:arc4random_uniform(256) / 255.0 green:arc4random_uniform(256) / 255.0 blue:arc4random_uniform(256) / 255.0 alpha:1.0] setStroke]; 130 | 131 | // 4. 渲染 132 | CGContextStrokePath(ctxRef); 133 | } 134 | 135 | 136 | @end 137 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFSnapView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFSnapView.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFBaseView.h" 10 | 11 | @interface WPFSnapView : WPFBaseView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFSnapView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFSnapView.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFSnapView.h" 10 | 11 | @implementation WPFSnapView 12 | 13 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 14 | 15 | // 0. 触摸之前要清零之前的吸附事件 16 | [self.animator removeAllBehaviors]; 17 | 18 | // 1. 获取触摸对象 19 | UITouch *touch = [touches anyObject]; 20 | 21 | // 2. 获取触摸点 22 | CGPoint loc = [touch locationInView:self]; 23 | 24 | // 3 添加吸附事件 25 | UISnapBehavior *snap = [[UISnapBehavior alloc] initWithItem:self.boxView snapToPoint:loc]; 26 | 27 | // 改变震动幅度,0表示振幅最大,1振幅最小 28 | snap.damping = 0.5; 29 | 30 | // 4. 将吸附事件添加到仿真者行为中 31 | [self.animator addBehavior:snap]; 32 | 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFSpringView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WPFSpringView.h 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFBaseView.h" 10 | #import "WPFAttachmentView.h" 11 | 12 | @interface WPFSpringView : WPFAttachmentView 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/WPFSpringView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WPFSpringView.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "WPFSpringView.h" 10 | 11 | @implementation WPFSpringView 12 | 13 | /* 14 | 15 | * KVO键值监听(观察者)->观察者模式 16 | * 如果没有观察者,需要我们自己定时去查看状态,对应的是【轮询】,观察者是替代我们解决轮询的问题。 17 | * 观察者模式的性能并不好,在实际开发中,要慎用! 18 | * 用完观察者最后要释放观察者 19 | 20 | * KVO参数说明: 21 | * 1> 观察者,谁来负责"对象"的"键值"变化的观察 22 | * 2> 观察的键值 23 | * 3> 数值发生变化时,通知哪一个数值变化。 24 | * 4> 通常是nil,要传也可以传一个字符串 25 | 26 | * 监听方法说明: 27 | * 1> 观察的键值 28 | * 2> 观察的对象 29 | * 3> 数值的新旧内容,取决于定义观察者时的选项 30 | * 4> 定义观察者时设置的上下文 31 | 32 | */ 33 | 34 | - (instancetype)init { 35 | 36 | if (self = [super init]) { 37 | 38 | // 振幅 39 | //self.attachment.damping = 1.0f; 40 | 41 | // 频率(让线具有弹性) 42 | self.attachment.frequency = 1.0f; 43 | 44 | UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:@[self.boxView]]; 45 | [self.animator addBehavior:gravity]; 46 | 47 | // 利用KVO监听方块中心点的改变 48 | /** 49 | self.boxView 被监听的对象 50 | observer 监听者 51 | keypath 监听的键值 52 | options 监听什么值 53 | */ 54 | 55 | [self.boxView addObserver:self forKeyPath:@"center" options:NSKeyValueObservingOptionNew context:nil]; 56 | 57 | } 58 | 59 | return self; 60 | 61 | } 62 | 63 | // 监听,当boxView 的中心店改变时就进行冲重绘 64 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 65 | 66 | [self setNeedsDisplay]; 67 | } 68 | 69 | 70 | #warning 销毁的时候要移除监听 71 | - (void)dealloc { 72 | 73 | [self.boxView removeObserver:self forKeyPath:@"center"]; 74 | 75 | } 76 | 77 | /* 78 | // Only override drawRect: if you perform custom drawing. 79 | // An empty implementation adversely affects performance during animation. 80 | - (void)drawRect:(CGRect)rect { 81 | // Drawing code 82 | } 83 | */ 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 02-多物理仿真 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. 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 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真Tests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真Tests/_2______Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // _2______Tests.m 3 | // 02-多物理仿真Tests 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface _2______Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation _2______Tests 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 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真UITests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /02-多物理仿真/02-多物理仿真UITests/_2______UITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // _2______UITests.m 3 | // 02-多物理仿真UITests 4 | // 5 | // Created by 王鹏飞 on 16/1/9. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface _2______UITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation _2______UITests 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 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0F1352771C4265EB00963E6F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F1352761C4265EB00963E6F /* main.m */; }; 11 | 0F13527A1C4265EB00963E6F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F1352791C4265EB00963E6F /* AppDelegate.m */; }; 12 | 0F13527D1C4265EB00963E6F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F13527C1C4265EB00963E6F /* ViewController.m */; }; 13 | 0F1352801C4265EB00963E6F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F13527E1C4265EB00963E6F /* Main.storyboard */; }; 14 | 0F1352821C4265EB00963E6F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0F1352811C4265EB00963E6F /* Assets.xcassets */; }; 15 | 0F1352851C4265EB00963E6F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F1352831C4265EB00963E6F /* LaunchScreen.storyboard */; }; 16 | 0F1352901C4265EB00963E6F /* _3_________Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F13528F1C4265EB00963E6F /* _3_________Tests.m */; }; 17 | 0F13529B1C4265EB00963E6F /* _3_________UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F13529A1C4265EB00963E6F /* _3_________UITests.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 0F13528C1C4265EB00963E6F /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 0F13526A1C4265EB00963E6F /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 0F1352711C4265EB00963E6F; 26 | remoteInfo = "03-多对象的附着行为"; 27 | }; 28 | 0F1352971C4265EB00963E6F /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 0F13526A1C4265EB00963E6F /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 0F1352711C4265EB00963E6F; 33 | remoteInfo = "03-多对象的附着行为"; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 0F1352721C4265EB00963E6F /* 03-多对象的附着行为.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "03-多对象的附着行为.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 0F1352761C4265EB00963E6F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 40 | 0F1352781C4265EB00963E6F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 41 | 0F1352791C4265EB00963E6F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 42 | 0F13527B1C4265EB00963E6F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | 0F13527C1C4265EB00963E6F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | 0F13527F1C4265EB00963E6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 0F1352811C4265EB00963E6F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | 0F1352841C4265EB00963E6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | 0F1352861C4265EB00963E6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 0F13528B1C4265EB00963E6F /* 03-多对象的附着行为Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "03-多对象的附着行为Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 0F13528F1C4265EB00963E6F /* _3_________Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "_3_________Tests.m"; sourceTree = ""; }; 50 | 0F1352911C4265EB00963E6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 0F1352961C4265EB00963E6F /* 03-多对象的附着行为UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "03-多对象的附着行为UITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 0F13529A1C4265EB00963E6F /* _3_________UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "_3_________UITests.m"; sourceTree = ""; }; 53 | 0F13529C1C4265EB00963E6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 0F13526F1C4265EB00963E6F /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | 0F1352881C4265EB00963E6F /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 0F1352931C4265EB00963E6F /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | 0F1352691C4265EB00963E6F = { 82 | isa = PBXGroup; 83 | children = ( 84 | 0F1352741C4265EB00963E6F /* 03-多对象的附着行为 */, 85 | 0F13528E1C4265EB00963E6F /* 03-多对象的附着行为Tests */, 86 | 0F1352991C4265EB00963E6F /* 03-多对象的附着行为UITests */, 87 | 0F1352731C4265EB00963E6F /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 0F1352731C4265EB00963E6F /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 0F1352721C4265EB00963E6F /* 03-多对象的附着行为.app */, 95 | 0F13528B1C4265EB00963E6F /* 03-多对象的附着行为Tests.xctest */, 96 | 0F1352961C4265EB00963E6F /* 03-多对象的附着行为UITests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 0F1352741C4265EB00963E6F /* 03-多对象的附着行为 */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 0F1352781C4265EB00963E6F /* AppDelegate.h */, 105 | 0F1352791C4265EB00963E6F /* AppDelegate.m */, 106 | 0F13527B1C4265EB00963E6F /* ViewController.h */, 107 | 0F13527C1C4265EB00963E6F /* ViewController.m */, 108 | 0F13527E1C4265EB00963E6F /* Main.storyboard */, 109 | 0F1352811C4265EB00963E6F /* Assets.xcassets */, 110 | 0F1352831C4265EB00963E6F /* LaunchScreen.storyboard */, 111 | 0F1352861C4265EB00963E6F /* Info.plist */, 112 | 0F1352751C4265EB00963E6F /* Supporting Files */, 113 | ); 114 | path = "03-多对象的附着行为"; 115 | sourceTree = ""; 116 | }; 117 | 0F1352751C4265EB00963E6F /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 0F1352761C4265EB00963E6F /* main.m */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | 0F13528E1C4265EB00963E6F /* 03-多对象的附着行为Tests */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 0F13528F1C4265EB00963E6F /* _3_________Tests.m */, 129 | 0F1352911C4265EB00963E6F /* Info.plist */, 130 | ); 131 | path = "03-多对象的附着行为Tests"; 132 | sourceTree = ""; 133 | }; 134 | 0F1352991C4265EB00963E6F /* 03-多对象的附着行为UITests */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 0F13529A1C4265EB00963E6F /* _3_________UITests.m */, 138 | 0F13529C1C4265EB00963E6F /* Info.plist */, 139 | ); 140 | path = "03-多对象的附着行为UITests"; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | 0F1352711C4265EB00963E6F /* 03-多对象的附着行为 */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = 0F13529F1C4265EB00963E6F /* Build configuration list for PBXNativeTarget "03-多对象的附着行为" */; 149 | buildPhases = ( 150 | 0F13526E1C4265EB00963E6F /* Sources */, 151 | 0F13526F1C4265EB00963E6F /* Frameworks */, 152 | 0F1352701C4265EB00963E6F /* Resources */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = "03-多对象的附着行为"; 159 | productName = "03-多对象的附着行为"; 160 | productReference = 0F1352721C4265EB00963E6F /* 03-多对象的附着行为.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | 0F13528A1C4265EB00963E6F /* 03-多对象的附着行为Tests */ = { 164 | isa = PBXNativeTarget; 165 | buildConfigurationList = 0F1352A21C4265EB00963E6F /* Build configuration list for PBXNativeTarget "03-多对象的附着行为Tests" */; 166 | buildPhases = ( 167 | 0F1352871C4265EB00963E6F /* Sources */, 168 | 0F1352881C4265EB00963E6F /* Frameworks */, 169 | 0F1352891C4265EB00963E6F /* Resources */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | 0F13528D1C4265EB00963E6F /* PBXTargetDependency */, 175 | ); 176 | name = "03-多对象的附着行为Tests"; 177 | productName = "03-多对象的附着行为Tests"; 178 | productReference = 0F13528B1C4265EB00963E6F /* 03-多对象的附着行为Tests.xctest */; 179 | productType = "com.apple.product-type.bundle.unit-test"; 180 | }; 181 | 0F1352951C4265EB00963E6F /* 03-多对象的附着行为UITests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = 0F1352A51C4265EB00963E6F /* Build configuration list for PBXNativeTarget "03-多对象的附着行为UITests" */; 184 | buildPhases = ( 185 | 0F1352921C4265EB00963E6F /* Sources */, 186 | 0F1352931C4265EB00963E6F /* Frameworks */, 187 | 0F1352941C4265EB00963E6F /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 0F1352981C4265EB00963E6F /* PBXTargetDependency */, 193 | ); 194 | name = "03-多对象的附着行为UITests"; 195 | productName = "03-多对象的附着行为UITests"; 196 | productReference = 0F1352961C4265EB00963E6F /* 03-多对象的附着行为UITests.xctest */; 197 | productType = "com.apple.product-type.bundle.ui-testing"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | 0F13526A1C4265EB00963E6F /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastUpgradeCheck = 0710; 206 | ORGANIZATIONNAME = "王鹏飞"; 207 | TargetAttributes = { 208 | 0F1352711C4265EB00963E6F = { 209 | CreatedOnToolsVersion = 7.1; 210 | }; 211 | 0F13528A1C4265EB00963E6F = { 212 | CreatedOnToolsVersion = 7.1; 213 | TestTargetID = 0F1352711C4265EB00963E6F; 214 | }; 215 | 0F1352951C4265EB00963E6F = { 216 | CreatedOnToolsVersion = 7.1; 217 | TestTargetID = 0F1352711C4265EB00963E6F; 218 | }; 219 | }; 220 | }; 221 | buildConfigurationList = 0F13526D1C4265EB00963E6F /* Build configuration list for PBXProject "03-多对象的附着行为" */; 222 | compatibilityVersion = "Xcode 3.2"; 223 | developmentRegion = English; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | Base, 228 | ); 229 | mainGroup = 0F1352691C4265EB00963E6F; 230 | productRefGroup = 0F1352731C4265EB00963E6F /* Products */; 231 | projectDirPath = ""; 232 | projectRoot = ""; 233 | targets = ( 234 | 0F1352711C4265EB00963E6F /* 03-多对象的附着行为 */, 235 | 0F13528A1C4265EB00963E6F /* 03-多对象的附着行为Tests */, 236 | 0F1352951C4265EB00963E6F /* 03-多对象的附着行为UITests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 0F1352701C4265EB00963E6F /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 0F1352851C4265EB00963E6F /* LaunchScreen.storyboard in Resources */, 247 | 0F1352821C4265EB00963E6F /* Assets.xcassets in Resources */, 248 | 0F1352801C4265EB00963E6F /* Main.storyboard in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | 0F1352891C4265EB00963E6F /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | 0F1352941C4265EB00963E6F /* Resources */ = { 260 | isa = PBXResourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | /* End PBXResourcesBuildPhase section */ 267 | 268 | /* Begin PBXSourcesBuildPhase section */ 269 | 0F13526E1C4265EB00963E6F /* Sources */ = { 270 | isa = PBXSourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | 0F13527D1C4265EB00963E6F /* ViewController.m in Sources */, 274 | 0F13527A1C4265EB00963E6F /* AppDelegate.m in Sources */, 275 | 0F1352771C4265EB00963E6F /* main.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | 0F1352871C4265EB00963E6F /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | 0F1352901C4265EB00963E6F /* _3_________Tests.m in Sources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | 0F1352921C4265EB00963E6F /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | 0F13529B1C4265EB00963E6F /* _3_________UITests.m in Sources */, 292 | ); 293 | runOnlyForDeploymentPostprocessing = 0; 294 | }; 295 | /* End PBXSourcesBuildPhase section */ 296 | 297 | /* Begin PBXTargetDependency section */ 298 | 0F13528D1C4265EB00963E6F /* PBXTargetDependency */ = { 299 | isa = PBXTargetDependency; 300 | target = 0F1352711C4265EB00963E6F /* 03-多对象的附着行为 */; 301 | targetProxy = 0F13528C1C4265EB00963E6F /* PBXContainerItemProxy */; 302 | }; 303 | 0F1352981C4265EB00963E6F /* PBXTargetDependency */ = { 304 | isa = PBXTargetDependency; 305 | target = 0F1352711C4265EB00963E6F /* 03-多对象的附着行为 */; 306 | targetProxy = 0F1352971C4265EB00963E6F /* PBXContainerItemProxy */; 307 | }; 308 | /* End PBXTargetDependency section */ 309 | 310 | /* Begin PBXVariantGroup section */ 311 | 0F13527E1C4265EB00963E6F /* Main.storyboard */ = { 312 | isa = PBXVariantGroup; 313 | children = ( 314 | 0F13527F1C4265EB00963E6F /* Base */, 315 | ); 316 | name = Main.storyboard; 317 | sourceTree = ""; 318 | }; 319 | 0F1352831C4265EB00963E6F /* LaunchScreen.storyboard */ = { 320 | isa = PBXVariantGroup; 321 | children = ( 322 | 0F1352841C4265EB00963E6F /* Base */, 323 | ); 324 | name = LaunchScreen.storyboard; 325 | sourceTree = ""; 326 | }; 327 | /* End PBXVariantGroup section */ 328 | 329 | /* Begin XCBuildConfiguration section */ 330 | 0F13529D1C4265EB00963E6F /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | ALWAYS_SEARCH_USER_PATHS = NO; 334 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 335 | CLANG_CXX_LIBRARY = "libc++"; 336 | CLANG_ENABLE_MODULES = YES; 337 | CLANG_ENABLE_OBJC_ARC = YES; 338 | CLANG_WARN_BOOL_CONVERSION = YES; 339 | CLANG_WARN_CONSTANT_CONVERSION = YES; 340 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 341 | CLANG_WARN_EMPTY_BODY = YES; 342 | CLANG_WARN_ENUM_CONVERSION = YES; 343 | CLANG_WARN_INT_CONVERSION = YES; 344 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 345 | CLANG_WARN_UNREACHABLE_CODE = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | DEBUG_INFORMATION_FORMAT = dwarf; 350 | ENABLE_STRICT_OBJC_MSGSEND = YES; 351 | ENABLE_TESTABILITY = YES; 352 | GCC_C_LANGUAGE_STANDARD = gnu99; 353 | GCC_DYNAMIC_NO_PIC = NO; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_OPTIMIZATION_LEVEL = 0; 356 | GCC_PREPROCESSOR_DEFINITIONS = ( 357 | "DEBUG=1", 358 | "$(inherited)", 359 | ); 360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 362 | GCC_WARN_UNDECLARED_SELECTOR = YES; 363 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 364 | GCC_WARN_UNUSED_FUNCTION = YES; 365 | GCC_WARN_UNUSED_VARIABLE = YES; 366 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 367 | MTL_ENABLE_DEBUG_INFO = YES; 368 | ONLY_ACTIVE_ARCH = YES; 369 | SDKROOT = iphoneos; 370 | }; 371 | name = Debug; 372 | }; 373 | 0F13529E1C4265EB00963E6F /* Release */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ALWAYS_SEARCH_USER_PATHS = NO; 377 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 378 | CLANG_CXX_LIBRARY = "libc++"; 379 | CLANG_ENABLE_MODULES = YES; 380 | CLANG_ENABLE_OBJC_ARC = YES; 381 | CLANG_WARN_BOOL_CONVERSION = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 384 | CLANG_WARN_EMPTY_BODY = YES; 385 | CLANG_WARN_ENUM_CONVERSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 388 | CLANG_WARN_UNREACHABLE_CODE = YES; 389 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 390 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 391 | COPY_PHASE_STRIP = NO; 392 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 393 | ENABLE_NS_ASSERTIONS = NO; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | GCC_C_LANGUAGE_STANDARD = gnu99; 396 | GCC_NO_COMMON_BLOCKS = YES; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 404 | MTL_ENABLE_DEBUG_INFO = NO; 405 | SDKROOT = iphoneos; 406 | VALIDATE_PRODUCT = YES; 407 | }; 408 | name = Release; 409 | }; 410 | 0F1352A01C4265EB00963E6F /* Debug */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 414 | INFOPLIST_FILE = "03-多对象的附着行为/Info.plist"; 415 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 416 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-3---------"; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | }; 419 | name = Debug; 420 | }; 421 | 0F1352A11C4265EB00963E6F /* Release */ = { 422 | isa = XCBuildConfiguration; 423 | buildSettings = { 424 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 425 | INFOPLIST_FILE = "03-多对象的附着行为/Info.plist"; 426 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 427 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-3---------"; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | }; 430 | name = Release; 431 | }; 432 | 0F1352A31C4265EB00963E6F /* Debug */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | BUNDLE_LOADER = "$(TEST_HOST)"; 436 | INFOPLIST_FILE = "03-多对象的附着行为Tests/Info.plist"; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 438 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-3---------Tests"; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/03-多对象的附着行为.app/03-多对象的附着行为"; 441 | }; 442 | name = Debug; 443 | }; 444 | 0F1352A41C4265EB00963E6F /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | BUNDLE_LOADER = "$(TEST_HOST)"; 448 | INFOPLIST_FILE = "03-多对象的附着行为Tests/Info.plist"; 449 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 450 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-3---------Tests"; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/03-多对象的附着行为.app/03-多对象的附着行为"; 453 | }; 454 | name = Release; 455 | }; 456 | 0F1352A61C4265EB00963E6F /* Debug */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | INFOPLIST_FILE = "03-多对象的附着行为UITests/Info.plist"; 460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 461 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-3---------UITests"; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | TEST_TARGET_NAME = "03-多对象的附着行为"; 464 | USES_XCTRUNNER = YES; 465 | }; 466 | name = Debug; 467 | }; 468 | 0F1352A71C4265EB00963E6F /* Release */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | INFOPLIST_FILE = "03-多对象的附着行为UITests/Info.plist"; 472 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 473 | PRODUCT_BUNDLE_IDENTIFIER = "com.wpfConpany.-3---------UITests"; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | TEST_TARGET_NAME = "03-多对象的附着行为"; 476 | USES_XCTRUNNER = YES; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 0F13526D1C4265EB00963E6F /* Build configuration list for PBXProject "03-多对象的附着行为" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 0F13529D1C4265EB00963E6F /* Debug */, 487 | 0F13529E1C4265EB00963E6F /* Release */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | 0F13529F1C4265EB00963E6F /* Build configuration list for PBXNativeTarget "03-多对象的附着行为" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | 0F1352A01C4265EB00963E6F /* Debug */, 496 | 0F1352A11C4265EB00963E6F /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | }; 500 | 0F1352A21C4265EB00963E6F /* Build configuration list for PBXNativeTarget "03-多对象的附着行为Tests" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | 0F1352A31C4265EB00963E6F /* Debug */, 504 | 0F1352A41C4265EB00963E6F /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | }; 508 | 0F1352A51C4265EB00963E6F /* Build configuration list for PBXNativeTarget "03-多对象的附着行为UITests" */ = { 509 | isa = XCConfigurationList; 510 | buildConfigurations = ( 511 | 0F1352A61C4265EB00963E6F /* Debug */, 512 | 0F1352A71C4265EB00963E6F /* Release */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | }; 516 | /* End XCConfigurationList section */ 517 | }; 518 | rootObject = 0F13526A1C4265EB00963E6F /* Project object */; 519 | } 520 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为.xcodeproj/project.xcworkspace/xcuserdata/wangpengfei.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PengfeiWang666/UIDynamic-/a10cba766c97bce10b20c235eb1cbaae52c55e95/03-多对象的附着行为/03-多对象的附着行为.xcodeproj/project.xcworkspace/xcuserdata/wangpengfei.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为.xcodeproj/xcuserdata/wangpengfei.xcuserdatad/xcschemes/03-多对象的附着行为.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 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为.xcodeproj/xcuserdata/wangpengfei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 03-多对象的附着行为.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 0F1352711C4265EB00963E6F 16 | 17 | primary 18 | 19 | 20 | 0F13528A1C4265EB00963E6F 21 | 22 | primary 23 | 24 | 25 | 0F1352951C4265EB00963E6F 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // 03-多对象的附着行为 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. 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 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // 03-多对象的附着行为 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/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 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/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 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // 03-多对象的附着行为 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // 03-多对象的附着行为 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | { 13 | UIDynamicAnimator *_animator; 14 | UIView *_headerView; 15 | UIAttachmentBehavior *_leaderAttach; 16 | 17 | } 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | 26 | // 1. 定义小圆球的frame 27 | CGFloat width = 20; 28 | CGFloat height = width; 29 | CGFloat startX = 100; 30 | CGFloat y = 0; 31 | 32 | // 创建一个可变数组用来存放小圆球 33 | NSMutableArray *roundArrM = [NSMutableArray array]; 34 | 35 | // 2. 循环创建小圆球 36 | for (NSInteger i = 0; i < 9; i ++) { 37 | 38 | // 2.1 实例化并设置frame 39 | CGFloat x = startX + i * width; 40 | UIView *roundV = [[UIView alloc] init]; 41 | 42 | // 2.2 设置小球颜色 43 | roundV.backgroundColor = [UIColor colorWithRed:arc4random_uniform(256) / 255.0 green:arc4random_uniform(256) / 255.0 blue:arc4random_uniform(256) / 255.0 alpha:1.0]; 44 | 45 | // 2.3 设置圆角 46 | roundV.layer.cornerRadius = 10; 47 | 48 | // 最后一个需要设置为大球 49 | if (i == 8) { 50 | 51 | width = 40; 52 | height = width; 53 | roundV.layer.cornerRadius = 20; 54 | _headerView = roundV; 55 | } 56 | roundV.frame = CGRectMake(x, y, width, height); 57 | // 2.4 添加到当前view 58 | [self.view addSubview:roundV]; 59 | 60 | // 2.5 添加到数组中 61 | [roundArrM addObject:roundV]; 62 | } 63 | 64 | // 3. 创建仿真者 65 | UIDynamicAnimator *animater = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; 66 | _animator = animater; 67 | // 4. 添加重力行为 68 | UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:roundArrM]; 69 | 70 | [animater addBehavior:gravity]; 71 | 72 | 73 | // 5. 添加边缘碰撞检测 74 | UICollisionBehavior *collision = [[UICollisionBehavior alloc] initWithItems:roundArrM]; 75 | collision.translatesReferenceBoundsIntoBoundary = YES; 76 | [animater addBehavior:collision]; 77 | 78 | // 6. 添加多元素的附着行为 79 | for (NSInteger i = 0; i < roundArrM.count - 1; i++) { 80 | 81 | // 给每个元素都添加一个一个附着行为,并添加到仿真者 82 | UIAttachmentBehavior *attachment = [[UIAttachmentBehavior alloc] initWithItem:roundArrM[i] attachedToItem:roundArrM[i + 1]]; 83 | [animater addBehavior:attachment]; 84 | 85 | } 86 | 87 | // 7. 添加手势识别器 88 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)]; 89 | [self.view addGestureRecognizer:pan]; 90 | 91 | } 92 | 93 | - (void)panAction:(UIPanGestureRecognizer *)pan { 94 | 95 | // 获取触摸点 96 | CGPoint loc = [pan locationInView:self.view]; 97 | 98 | 99 | if (pan.state == UIGestureRecognizerStateBegan) { 100 | 101 | // 与headerView建立附着关系 102 | _leaderAttach = [[UIAttachmentBehavior alloc] initWithItem:_headerView attachedToAnchor:loc]; 103 | 104 | [_animator addBehavior:_leaderAttach]; 105 | 106 | 107 | } else if (pan.state == UIGestureRecognizerStateChanged) { 108 | 109 | // 如果拖拽正在进行,就转换附着点 110 | _leaderAttach.anchorPoint = loc; 111 | 112 | } else if (pan.state == UIGestureRecognizerStateEnded) { 113 | 114 | // 如果拖拽结束,就移除附着行为 115 | [_animator removeBehavior:_leaderAttach]; 116 | 117 | } 118 | 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 03-多对象的附着行为 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. 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 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为Tests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为Tests/_3_________Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // _3_________Tests.m 3 | // 03-多对象的附着行为Tests 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface _3_________Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation _3_________Tests 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 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为UITests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /03-多对象的附着行为/03-多对象的附着行为UITests/_3_________UITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // _3_________UITests.m 3 | // 03-多对象的附着行为UITests 4 | // 5 | // Created by 王鹏飞 on 16/1/10. 6 | // Copyright © 2016年 王鹏飞. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface _3_________UITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation _3_________UITests 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 | --------------------------------------------------------------------------------