├── .gitignore ├── 2017-05-25 16_10_36.gif ├── LICENSE ├── README.md └── cell拖动添加删除 ├── cell拖动添加删除.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── cell拖动添加删除 ├── AppCollectionViewCell.h ├── AppCollectionViewCell.m ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Contents.json └── 应用图标 │ ├── Contents.json │ ├── icaiwuyun.imageset │ ├── Contents.json │ └── icaiwuyun.png │ ├── icbaobiao.imageset │ ├── Contents.json │ └── icbaobiao.png │ ├── icchanghongyouxiang.imageset │ ├── Contents.json │ └── icchanghongyouxiang.png │ ├── icfuwucaigou.imageset │ ├── Contents.json │ └── icfuwucaigou.png │ ├── icgongwenchengbao.imageset │ ├── Contents.json │ └── icgongwenchengbao.png │ ├── ichongjinbao1.imageset │ ├── Contents.json │ └── ichongjinbao1.png │ ├── ichuiyi.imageset │ ├── Contents.json │ └── ichuiyi.png │ ├── icrenwu.imageset │ ├── Contents.json │ └── icrenwu.png │ ├── icrichengLS.imageset │ ├── Contents.json │ └── icrichengLS.png │ ├── icshenghuofuwu.imageset │ ├── Contents.json │ └── icshenghuofuwu.png │ ├── icshenpi.imageset │ ├── Contents.json │ └── icshenpi.png │ ├── ictongxunlu.imageset │ ├── Contents.json │ └── ictongxunlu.png │ ├── icwenjian.imageset │ ├── Contents.json │ └── icwenjian.png │ ├── icyuangongzizhu.imageset │ ├── Contents.json │ └── icyuangongzizhu.png │ ├── iczixun.imageset │ ├── Contents.json │ └── iczixun.png │ └── shanchu.imageset │ ├── Contents.json │ └── shanchu.png ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m ├── dataModel.h ├── dataModel.m └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /2017-05-25 16_10_36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/2017-05-25 16_10_36.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Li Weiguang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # collectionViewCell 2 | 一种类似于支付宝首页对应用进行编辑,添加删除排序的页面 3 | ![img](https://github.com/lwg123/collectionViewCell/blob/master/2017-05-25%2016_10_36.gif) 4 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D130617D1ED672FC009F4BF1 /* dataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D130617C1ED672FC009F4BF1 /* dataModel.m */; }; 11 | D180353C1ED55B6200DDBBFE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D180353B1ED55B6200DDBBFE /* main.m */; }; 12 | D180353F1ED55B6200DDBBFE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D180353E1ED55B6200DDBBFE /* AppDelegate.m */; }; 13 | D18035421ED55B6200DDBBFE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D18035411ED55B6200DDBBFE /* ViewController.m */; }; 14 | D18035451ED55B6200DDBBFE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D18035431ED55B6200DDBBFE /* Main.storyboard */; }; 15 | D18035471ED55B6200DDBBFE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D18035461ED55B6200DDBBFE /* Assets.xcassets */; }; 16 | D180354A1ED55B6200DDBBFE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D18035481ED55B6200DDBBFE /* LaunchScreen.storyboard */; }; 17 | D18035561ED5809400DDBBFE /* AppCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D18035551ED5809400DDBBFE /* AppCollectionViewCell.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | D130617B1ED672FC009F4BF1 /* dataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dataModel.h; sourceTree = ""; }; 22 | D130617C1ED672FC009F4BF1 /* dataModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = dataModel.m; sourceTree = ""; }; 23 | D18035371ED55B6200DDBBFE /* cell拖动添加删除.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cell拖动添加删除.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | D180353B1ED55B6200DDBBFE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 25 | D180353D1ED55B6200DDBBFE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | D180353E1ED55B6200DDBBFE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | D18035401ED55B6200DDBBFE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 28 | D18035411ED55B6200DDBBFE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 29 | D18035441ED55B6200DDBBFE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 30 | D18035461ED55B6200DDBBFE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 31 | D18035491ED55B6200DDBBFE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 32 | D180354B1ED55B6200DDBBFE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | D18035541ED5809400DDBBFE /* AppCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppCollectionViewCell.h; sourceTree = ""; }; 34 | D18035551ED5809400DDBBFE /* AppCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppCollectionViewCell.m; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | D18035341ED55B6200DDBBFE /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | D180352E1ED55B6200DDBBFE = { 49 | isa = PBXGroup; 50 | children = ( 51 | D18035391ED55B6200DDBBFE /* cell拖动添加删除 */, 52 | D18035381ED55B6200DDBBFE /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | D18035381ED55B6200DDBBFE /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | D18035371ED55B6200DDBBFE /* cell拖动添加删除.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | D18035391ED55B6200DDBBFE /* cell拖动添加删除 */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | D180353D1ED55B6200DDBBFE /* AppDelegate.h */, 68 | D180353E1ED55B6200DDBBFE /* AppDelegate.m */, 69 | D18035401ED55B6200DDBBFE /* ViewController.h */, 70 | D18035411ED55B6200DDBBFE /* ViewController.m */, 71 | D18035541ED5809400DDBBFE /* AppCollectionViewCell.h */, 72 | D18035551ED5809400DDBBFE /* AppCollectionViewCell.m */, 73 | D130617B1ED672FC009F4BF1 /* dataModel.h */, 74 | D130617C1ED672FC009F4BF1 /* dataModel.m */, 75 | D18035431ED55B6200DDBBFE /* Main.storyboard */, 76 | D18035461ED55B6200DDBBFE /* Assets.xcassets */, 77 | D18035481ED55B6200DDBBFE /* LaunchScreen.storyboard */, 78 | D180354B1ED55B6200DDBBFE /* Info.plist */, 79 | D180353A1ED55B6200DDBBFE /* Supporting Files */, 80 | ); 81 | path = "cell拖动添加删除"; 82 | sourceTree = ""; 83 | }; 84 | D180353A1ED55B6200DDBBFE /* Supporting Files */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | D180353B1ED55B6200DDBBFE /* main.m */, 88 | ); 89 | name = "Supporting Files"; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXNativeTarget section */ 95 | D18035361ED55B6200DDBBFE /* cell拖动添加删除 */ = { 96 | isa = PBXNativeTarget; 97 | buildConfigurationList = D180354E1ED55B6200DDBBFE /* Build configuration list for PBXNativeTarget "cell拖动添加删除" */; 98 | buildPhases = ( 99 | D18035331ED55B6200DDBBFE /* Sources */, 100 | D18035341ED55B6200DDBBFE /* Frameworks */, 101 | D18035351ED55B6200DDBBFE /* Resources */, 102 | ); 103 | buildRules = ( 104 | ); 105 | dependencies = ( 106 | ); 107 | name = "cell拖动添加删除"; 108 | productName = "cell拖动添加删除"; 109 | productReference = D18035371ED55B6200DDBBFE /* cell拖动添加删除.app */; 110 | productType = "com.apple.product-type.application"; 111 | }; 112 | /* End PBXNativeTarget section */ 113 | 114 | /* Begin PBXProject section */ 115 | D180352F1ED55B6200DDBBFE /* Project object */ = { 116 | isa = PBXProject; 117 | attributes = { 118 | LastUpgradeCheck = 0820; 119 | ORGANIZATIONNAME = weiguang; 120 | TargetAttributes = { 121 | D18035361ED55B6200DDBBFE = { 122 | CreatedOnToolsVersion = 8.2.1; 123 | ProvisioningStyle = Automatic; 124 | }; 125 | }; 126 | }; 127 | buildConfigurationList = D18035321ED55B6200DDBBFE /* Build configuration list for PBXProject "cell拖动添加删除" */; 128 | compatibilityVersion = "Xcode 3.2"; 129 | developmentRegion = English; 130 | hasScannedForEncodings = 0; 131 | knownRegions = ( 132 | en, 133 | Base, 134 | ); 135 | mainGroup = D180352E1ED55B6200DDBBFE; 136 | productRefGroup = D18035381ED55B6200DDBBFE /* Products */; 137 | projectDirPath = ""; 138 | projectRoot = ""; 139 | targets = ( 140 | D18035361ED55B6200DDBBFE /* cell拖动添加删除 */, 141 | ); 142 | }; 143 | /* End PBXProject section */ 144 | 145 | /* Begin PBXResourcesBuildPhase section */ 146 | D18035351ED55B6200DDBBFE /* Resources */ = { 147 | isa = PBXResourcesBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | D180354A1ED55B6200DDBBFE /* LaunchScreen.storyboard in Resources */, 151 | D18035471ED55B6200DDBBFE /* Assets.xcassets in Resources */, 152 | D18035451ED55B6200DDBBFE /* Main.storyboard in Resources */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXResourcesBuildPhase section */ 157 | 158 | /* Begin PBXSourcesBuildPhase section */ 159 | D18035331ED55B6200DDBBFE /* Sources */ = { 160 | isa = PBXSourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | D18035421ED55B6200DDBBFE /* ViewController.m in Sources */, 164 | D130617D1ED672FC009F4BF1 /* dataModel.m in Sources */, 165 | D18035561ED5809400DDBBFE /* AppCollectionViewCell.m in Sources */, 166 | D180353F1ED55B6200DDBBFE /* AppDelegate.m in Sources */, 167 | D180353C1ED55B6200DDBBFE /* main.m in Sources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXSourcesBuildPhase section */ 172 | 173 | /* Begin PBXVariantGroup section */ 174 | D18035431ED55B6200DDBBFE /* Main.storyboard */ = { 175 | isa = PBXVariantGroup; 176 | children = ( 177 | D18035441ED55B6200DDBBFE /* Base */, 178 | ); 179 | name = Main.storyboard; 180 | sourceTree = ""; 181 | }; 182 | D18035481ED55B6200DDBBFE /* LaunchScreen.storyboard */ = { 183 | isa = PBXVariantGroup; 184 | children = ( 185 | D18035491ED55B6200DDBBFE /* Base */, 186 | ); 187 | name = LaunchScreen.storyboard; 188 | sourceTree = ""; 189 | }; 190 | /* End PBXVariantGroup section */ 191 | 192 | /* Begin XCBuildConfiguration section */ 193 | D180354C1ED55B6200DDBBFE /* Debug */ = { 194 | isa = XCBuildConfiguration; 195 | buildSettings = { 196 | ALWAYS_SEARCH_USER_PATHS = NO; 197 | CLANG_ANALYZER_NONNULL = YES; 198 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 199 | CLANG_CXX_LIBRARY = "libc++"; 200 | CLANG_ENABLE_MODULES = YES; 201 | CLANG_ENABLE_OBJC_ARC = YES; 202 | CLANG_WARN_BOOL_CONVERSION = YES; 203 | CLANG_WARN_CONSTANT_CONVERSION = YES; 204 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 205 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 206 | CLANG_WARN_EMPTY_BODY = YES; 207 | CLANG_WARN_ENUM_CONVERSION = YES; 208 | CLANG_WARN_INFINITE_RECURSION = YES; 209 | CLANG_WARN_INT_CONVERSION = YES; 210 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 211 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 212 | CLANG_WARN_UNREACHABLE_CODE = YES; 213 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 214 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 215 | COPY_PHASE_STRIP = NO; 216 | DEBUG_INFORMATION_FORMAT = dwarf; 217 | ENABLE_STRICT_OBJC_MSGSEND = YES; 218 | ENABLE_TESTABILITY = YES; 219 | GCC_C_LANGUAGE_STANDARD = gnu99; 220 | GCC_DYNAMIC_NO_PIC = NO; 221 | GCC_NO_COMMON_BLOCKS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PREPROCESSOR_DEFINITIONS = ( 224 | "DEBUG=1", 225 | "$(inherited)", 226 | ); 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 229 | GCC_WARN_UNDECLARED_SELECTOR = YES; 230 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 231 | GCC_WARN_UNUSED_FUNCTION = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 234 | MTL_ENABLE_DEBUG_INFO = YES; 235 | ONLY_ACTIVE_ARCH = YES; 236 | SDKROOT = iphoneos; 237 | }; 238 | name = Debug; 239 | }; 240 | D180354D1ED55B6200DDBBFE /* Release */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_ANALYZER_NONNULL = YES; 245 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 246 | CLANG_CXX_LIBRARY = "libc++"; 247 | CLANG_ENABLE_MODULES = YES; 248 | CLANG_ENABLE_OBJC_ARC = YES; 249 | CLANG_WARN_BOOL_CONVERSION = YES; 250 | CLANG_WARN_CONSTANT_CONVERSION = YES; 251 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 252 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 253 | CLANG_WARN_EMPTY_BODY = YES; 254 | CLANG_WARN_ENUM_CONVERSION = YES; 255 | CLANG_WARN_INFINITE_RECURSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 258 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 259 | CLANG_WARN_UNREACHABLE_CODE = YES; 260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 261 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 262 | COPY_PHASE_STRIP = NO; 263 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 264 | ENABLE_NS_ASSERTIONS = NO; 265 | ENABLE_STRICT_OBJC_MSGSEND = YES; 266 | GCC_C_LANGUAGE_STANDARD = gnu99; 267 | GCC_NO_COMMON_BLOCKS = YES; 268 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 269 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 270 | GCC_WARN_UNDECLARED_SELECTOR = YES; 271 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 272 | GCC_WARN_UNUSED_FUNCTION = YES; 273 | GCC_WARN_UNUSED_VARIABLE = YES; 274 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 275 | MTL_ENABLE_DEBUG_INFO = NO; 276 | SDKROOT = iphoneos; 277 | VALIDATE_PRODUCT = YES; 278 | }; 279 | name = Release; 280 | }; 281 | D180354F1ED55B6200DDBBFE /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 285 | INFOPLIST_FILE = "cell拖动添加删除/Info.plist"; 286 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 287 | PRODUCT_BUNDLE_IDENTIFIER = "changhong.cell------"; 288 | PRODUCT_NAME = "$(TARGET_NAME)"; 289 | }; 290 | name = Debug; 291 | }; 292 | D18035501ED55B6200DDBBFE /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | INFOPLIST_FILE = "cell拖动添加删除/Info.plist"; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | PRODUCT_BUNDLE_IDENTIFIER = "changhong.cell------"; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | }; 301 | name = Release; 302 | }; 303 | /* End XCBuildConfiguration section */ 304 | 305 | /* Begin XCConfigurationList section */ 306 | D18035321ED55B6200DDBBFE /* Build configuration list for PBXProject "cell拖动添加删除" */ = { 307 | isa = XCConfigurationList; 308 | buildConfigurations = ( 309 | D180354C1ED55B6200DDBBFE /* Debug */, 310 | D180354D1ED55B6200DDBBFE /* Release */, 311 | ); 312 | defaultConfigurationIsVisible = 0; 313 | defaultConfigurationName = Release; 314 | }; 315 | D180354E1ED55B6200DDBBFE /* Build configuration list for PBXNativeTarget "cell拖动添加删除" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | D180354F1ED55B6200DDBBFE /* Debug */, 319 | D18035501ED55B6200DDBBFE /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | /* End XCConfigurationList section */ 325 | }; 326 | rootObject = D180352F1ED55B6200DDBBFE /* Project object */; 327 | } 328 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/AppCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppCollectionViewCell.h 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/24. 6 | // Copyright © 2017年 weiguang. All rights reserved. 7 | // 8 | 9 | #define RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] 10 | 11 | #import 12 | #import "dataModel.h" 13 | 14 | @interface AppCollectionViewCell : UICollectionViewCell 15 | 16 | @property (nonatomic,strong) UIButton *deleteBtn; 17 | @property (nonatomic,strong) UIImageView *appImageView; 18 | @property (nonatomic,strong) UILabel *nameLabel; 19 | 20 | - (void)showInfoWithModel:(dataModel *)model; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/AppCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppCollectionViewCell.m 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/24. 6 | // Copyright © 2017年 weiguang. All rights reserved. 7 | // 8 | 9 | #import "AppCollectionViewCell.h" 10 | 11 | 12 | @implementation AppCollectionViewCell 13 | 14 | 15 | 16 | // 从storyboard中加载cell时才调用此方法 17 | - (void)awakeFromNib { 18 | [super awakeFromNib]; 19 | 20 | self.contentView.backgroundColor = [UIColor whiteColor]; 21 | self.deleteBtn.hidden = YES; 22 | 23 | } 24 | 25 | // 通过注册cell的方式加载,调用此方法 26 | - (instancetype)initWithFrame:(CGRect)frame { 27 | 28 | self = [super initWithFrame:frame]; 29 | 30 | if (self) { 31 | _appImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width/3, self.frame.size.width/3)]; 32 | 33 | _appImageView.center = CGPointMake(self.frame.size.width / 2.0, self.frame.size.height / 2.0 - 10); 34 | [self.contentView addSubview:_appImageView]; 35 | 36 | _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 20)]; 37 | _nameLabel.backgroundColor = [UIColor clearColor]; 38 | _nameLabel.font = [UIFont boldSystemFontOfSize:12.0]; 39 | _nameLabel.textAlignment = NSTextAlignmentCenter; 40 | _nameLabel.textColor = RGB(55, 55, 55); 41 | _nameLabel.center = CGPointMake(self.frame.size.width / 2.0, _appImageView.frame.origin.y + _appImageView.frame.size.height + _nameLabel.frame.size.height / 2.0 + 3); 42 | [self.contentView addSubview:_nameLabel]; 43 | 44 | 45 | _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 46 | [_deleteBtn setImage:[UIImage imageNamed:@"shanchu"] forState:UIControlStateNormal]; 47 | _deleteBtn.frame = CGRectMake(self.frame.size.width - 30, 0, 30, 30); 48 | _deleteBtn.imageEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5); 49 | _deleteBtn.hidden = YES; 50 | [self.contentView addSubview:_deleteBtn]; 51 | 52 | self.contentView.backgroundColor = [UIColor whiteColor]; 53 | } 54 | 55 | return self; 56 | } 57 | 58 | 59 | - (void)showInfoWithModel:(dataModel *)model { 60 | 61 | _nameLabel.text = model.appName; 62 | _appImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",model.imageName]]; 63 | } 64 | 65 | 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/24. 6 | // Copyright © 2017年 weiguang. 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 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/24. 6 | // Copyright © 2017年 weiguang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icaiwuyun.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icaiwuyun.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icaiwuyun.imageset/icaiwuyun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icaiwuyun.imageset/icaiwuyun.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icbaobiao.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icbaobiao.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icbaobiao.imageset/icbaobiao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icbaobiao.imageset/icbaobiao.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icchanghongyouxiang.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icchanghongyouxiang.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icchanghongyouxiang.imageset/icchanghongyouxiang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icchanghongyouxiang.imageset/icchanghongyouxiang.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icfuwucaigou.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icfuwucaigou.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icfuwucaigou.imageset/icfuwucaigou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icfuwucaigou.imageset/icfuwucaigou.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icgongwenchengbao.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icgongwenchengbao.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icgongwenchengbao.imageset/icgongwenchengbao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icgongwenchengbao.imageset/icgongwenchengbao.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ichongjinbao1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "ichongjinbao1.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ichongjinbao1.imageset/ichongjinbao1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ichongjinbao1.imageset/ichongjinbao1.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ichuiyi.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "ichuiyi.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ichuiyi.imageset/ichuiyi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ichuiyi.imageset/ichuiyi.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icrenwu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icrenwu.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icrenwu.imageset/icrenwu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icrenwu.imageset/icrenwu.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icrichengLS.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icrichengLS.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icrichengLS.imageset/icrichengLS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icrichengLS.imageset/icrichengLS.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icshenghuofuwu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icshenghuofuwu.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icshenghuofuwu.imageset/icshenghuofuwu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icshenghuofuwu.imageset/icshenghuofuwu.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icshenpi.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icshenpi.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icshenpi.imageset/icshenpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icshenpi.imageset/icshenpi.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ictongxunlu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "ictongxunlu.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ictongxunlu.imageset/ictongxunlu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/ictongxunlu.imageset/ictongxunlu.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icwenjian.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icwenjian.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icwenjian.imageset/icwenjian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icwenjian.imageset/icwenjian.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icyuangongzizhu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icyuangongzizhu.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icyuangongzizhu.imageset/icyuangongzizhu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/icyuangongzizhu.imageset/icyuangongzizhu.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/iczixun.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "iczixun.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/iczixun.imageset/iczixun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/iczixun.imageset/iczixun.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/shanchu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "shanchu.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/shanchu.imageset/shanchu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lwg123/collectionViewCell/5a54dcf61d088c55b0d7001ccb083c01729d0b1e/cell拖动添加删除/cell拖动添加删除/Assets.xcassets/应用图标/shanchu.imageset/shanchu.png -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/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 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/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 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/24. 6 | // Copyright © 2017年 weiguang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/24. 6 | // Copyright © 2017年 weiguang. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "AppCollectionViewCell.h" 11 | 12 | 13 | static NSString *identifier = @"AppsCell"; 14 | 15 | static CGFloat itemMargin = 15; 16 | static CGFloat leftMargin = 5; 17 | 18 | @interface ViewController () 19 | { 20 | BOOL isEditing; 21 | UIButton *rightButton; 22 | UIButton *leftButton; 23 | } 24 | 25 | @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; 26 | 27 | @property (nonatomic,strong) NSMutableArray *viewModels; 28 | @property (nonatomic,strong) UILongPressGestureRecognizer *longPress; 29 | @property (nonatomic, strong) NSIndexPath *originalIndexPath; 30 | @property (nonatomic, weak) UIView *tempMoveCell; 31 | @property (nonatomic, assign) CGPoint lastPoint; 32 | @property (nonatomic, strong) NSIndexPath *moveIndexPath; 33 | 34 | 35 | @end 36 | 37 | @implementation ViewController 38 | 39 | - (void)viewDidLoad { 40 | [super viewDidLoad]; 41 | 42 | [self setupUI]; 43 | 44 | [self getData]; 45 | } 46 | 47 | // 获取数据源,此处为固定的 48 | - (void)getData{ 49 | 50 | _viewModels = [NSMutableArray array]; 51 | 52 | NSArray *dataArr = @[@{@"imageName" : @"icaiwuyun", @"appName" : @"财务云"}, @{@"imageName" : @"icbaobiao", @"appName" : @"报表"}, @{@"imageName" : @"icchanghongyouxiang", @"appName" : @"邮箱"}, @{@"imageName" : @"icfuwucaigou", @"appName" : @"服务采购"}, @{@"imageName" : @"icgongwenchengbao", @"appName" : @"呈报"}, @{@"imageName" : @"icrenwu", @"appName" : @"任务"}, @{@"imageName" : @"icshenghuofuwu", @"appName" : @"生活服务"}, @{@"imageName" : @"icshenpi", @"appName" : @"审批"}, @{@"imageName" : @"icwenjian", @"appName" : @"文件"}, @{@"imageName" : @"iczixun", @"appName" : @"资讯"}]; 53 | 54 | for (NSDictionary *dict in dataArr) { 55 | 56 | dataModel *model = [dataModel initWithDict:dict]; 57 | [_viewModels addObject:model]; 58 | } 59 | } 60 | 61 | // 设置UI界面 62 | - (void)setupUI{ 63 | 64 | isEditing = NO; 65 | self.automaticallyAdjustsScrollViewInsets = NO; 66 | _collectionView.backgroundColor = RGB(238, 238, 244); 67 | _collectionView.alwaysBounceVertical = YES; 68 | 69 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 70 | CGFloat itemH = ([UIScreen mainScreen].bounds.size.width - 3 * itemMargin - 2 * leftMargin) / 4; 71 | layout.itemSize = CGSizeMake(itemH, itemH); 72 | layout.minimumLineSpacing = itemMargin; 73 | layout.minimumInteritemSpacing = itemMargin; 74 | 75 | _collectionView.collectionViewLayout = layout; 76 | 77 | _longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressMoving:)]; 78 | _longPress.minimumPressDuration = 1.0; 79 | [_collectionView addGestureRecognizer:_longPress]; 80 | 81 | // 如果使用storyboard来加载cell就不要在注册了,否则会调用initWithFrame方法,重新加载一遍 82 | [_collectionView registerClass:[AppCollectionViewCell class] forCellWithReuseIdentifier:identifier]; 83 | 84 | // 在storyboard中已设置过dataSource和delegate 85 | //_collectionView.dataSource = self; 86 | _collectionView.contentInset = UIEdgeInsetsMake(leftMargin, leftMargin, 0, leftMargin); 87 | 88 | // 设置右边的item 89 | rightButton = [self setupBarButtonItem:@"完成"]; 90 | [rightButton addTarget:self action:@selector(rightItemClick) forControlEvents:UIControlEventTouchUpInside]; 91 | UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton]; 92 | self.navigationItem.rightBarButtonItem = rightItem; 93 | rightButton.hidden = YES; 94 | 95 | // 设置左边添加按钮 96 | leftButton = [self setupBarButtonItem:@"添加"]; 97 | [leftButton addTarget:self action:@selector(leftItemClick) forControlEvents:UIControlEventTouchUpInside]; 98 | UIBarButtonItem *lefItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton]; 99 | self.navigationItem.leftBarButtonItem = lefItem; 100 | } 101 | 102 | 103 | #pragma mark - 长按cell进入编辑状态,可以进行移动删除操作 104 | - (void)longPressMoving:(UILongPressGestureRecognizer *)longPress { 105 | switch (longPress.state) { 106 | case UIGestureRecognizerStateBegan: 107 | { 108 | //获取当前手指长按的cell的indexPath 109 | _originalIndexPath = [_collectionView indexPathForItemAtPoint:[longPress locationInView:_collectionView]]; 110 | if (_originalIndexPath.row > _viewModels.count) { 111 | return; 112 | } 113 | 114 | if (!isEditing) { 115 | [self enterEditingModel]; 116 | } 117 | 118 | //获取到手指所在cell 119 | AppCollectionViewCell *cell = (AppCollectionViewCell *)[_collectionView cellForItemAtIndexPath:_originalIndexPath]; 120 | 121 | //生成一个和cell一样的view,类似于生成快照 122 | UIView *cellView = [self viewFromCell:cell]; 123 | // 生成cellView一样的image 124 | UIImage *cellImage = [self imageFromView:cellView]; 125 | UIImageView *snapView = [[UIImageView alloc] initWithImage:cellImage]; 126 | // 临时cell 127 | _tempMoveCell = snapView; 128 | _tempMoveCell.frame = cell.frame; 129 | 130 | // 当前的真实cell隐藏,表面上显示的临时的cell 131 | cell.hidden = YES; 132 | [_collectionView addSubview:_tempMoveCell]; 133 | 134 | _lastPoint = [longPress locationOfTouch:0 inView:longPress.view]; 135 | 136 | } 137 | break; 138 | case UIGestureRecognizerStateChanged: 139 | { 140 | // 当前cell移动的相对距离 141 | CGFloat tranX = [longPress locationOfTouch:0 inView:longPress.view].x - _lastPoint.x; 142 | CGFloat tranY = [longPress locationOfTouch:0 inView:longPress.view].y - _lastPoint.y; 143 | /* 144 | 函数说明:某点通过矩阵变换之后的点 145 | CGPoint CGPointApplyAffineTransform(CGPoint point, CGAffineTransform t) 146 | point:某点 147 | t:变换矩阵 148 | 149 | 相对平移函数:(相对的是屏幕的左上角(0,0)点) 150 | CGAffineTransformMakeTranslation(CGFloat tx,CGFloat ty) 151 | */ 152 | 153 | _tempMoveCell.center = CGPointApplyAffineTransform(_tempMoveCell.center, CGAffineTransformMakeTranslation(tranX, tranY)); 154 | _lastPoint = [longPress locationOfTouch:0 inView:longPress.view]; 155 | // 移动cell 156 | [self moveCell]; 157 | 158 | } 159 | break; 160 | case UIGestureRecognizerStateEnded: 161 | case UIGestureRecognizerStateCancelled: 162 | { 163 | if (_originalIndexPath.row > _viewModels.count) { 164 | return; 165 | } 166 | AppCollectionViewCell *cell = (AppCollectionViewCell *)[_collectionView cellForItemAtIndexPath:_originalIndexPath]; 167 | _collectionView.userInteractionEnabled = NO; 168 | cell.hidden = NO; 169 | cell.alpha = 0.0; 170 | 171 | [UIView animateWithDuration:0.25 animations:^{ 172 | _tempMoveCell.center = cell.center; 173 | _tempMoveCell.alpha = 0.0; 174 | cell.alpha = 1.0; 175 | 176 | } completion:^(BOOL finished) { 177 | [_tempMoveCell removeFromSuperview]; 178 | _originalIndexPath = nil; 179 | _tempMoveCell = nil; 180 | _collectionView.userInteractionEnabled = YES; 181 | 182 | }]; 183 | 184 | } 185 | break; 186 | default: 187 | break; 188 | } 189 | } 190 | 191 | - (void)moveCell{ 192 | for (AppCollectionViewCell *cell in [_collectionView visibleCells]) { 193 | NSIndexPath *index = [_collectionView indexPathForCell:cell]; 194 | if (index == _originalIndexPath) { 195 | continue; 196 | } 197 | //计算中心距 198 | CGFloat spacingX = fabs(_tempMoveCell.center.x - cell.center.x); 199 | CGFloat spacingY = fabs(_tempMoveCell.center.y - cell.center.y); 200 | if (spacingX <= _tempMoveCell.bounds.size.width / 2.0f && spacingY <= _tempMoveCell.bounds.size.height / 2.0f) { 201 | _moveIndexPath = [_collectionView indexPathForCell:cell]; 202 | if (_moveIndexPath.row<_viewModels.count) { //超出cell范围时移动会崩溃 203 | //更新数据源 204 | [self updateDataSource]; 205 | //移动 206 | [_collectionView moveItemAtIndexPath:_originalIndexPath toIndexPath:_moveIndexPath]; 207 | //设置移动后的起始indexPath 208 | _originalIndexPath = _moveIndexPath; 209 | } 210 | 211 | break; 212 | } 213 | } 214 | 215 | } 216 | 217 | 218 | 219 | //更新数据源 220 | - (void)updateDataSource{ 221 | NSMutableArray *temp = @[].mutableCopy; 222 | [temp addObjectsFromArray:_viewModels]; 223 | if (_moveIndexPath.item > _originalIndexPath.item) { 224 | for (NSUInteger i = _originalIndexPath.item; i < _moveIndexPath.item ; i++) { 225 | [temp exchangeObjectAtIndex:i withObjectAtIndex:i + 1]; 226 | } 227 | }else{ 228 | for (NSUInteger i = _originalIndexPath.item; i > _moveIndexPath.item ; i--) { 229 | [temp exchangeObjectAtIndex:i withObjectAtIndex:i - 1]; 230 | } 231 | } 232 | _viewModels = temp.mutableCopy; 233 | } 234 | 235 | 236 | #pragma mark - App editing 237 | // 进入编辑状态 238 | - (void)enterEditingModel{ 239 | isEditing = YES; 240 | rightButton.hidden = NO; 241 | _longPress.minimumPressDuration = 0.5; 242 | 243 | for (AppCollectionViewCell *cell in [self.collectionView visibleCells]) { 244 | cell.deleteBtn.hidden = NO; 245 | } 246 | 247 | } 248 | 249 | - (void)stopEditingModel { 250 | isEditing = NO; 251 | _longPress.minimumPressDuration = 1.0; 252 | rightButton.hidden = YES; 253 | 254 | for (AppCollectionViewCell *cell in [self.collectionView visibleCells]) { 255 | cell.deleteBtn.hidden = YES; 256 | } 257 | } 258 | 259 | 260 | #pragma mark - 生成左右button 261 | - (UIButton *)setupBarButtonItem:(NSString *)title { 262 | 263 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 264 | button.frame = CGRectMake(0, 0, 50, 30); 265 | [button setBackgroundColor:[UIColor clearColor]]; 266 | [button setTitle:title forState:UIControlStateNormal]; 267 | [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; 268 | button.titleLabel.font = [UIFont systemFontOfSize:16]; 269 | 270 | return button; 271 | } 272 | 273 | #pragma mark - 生成一个和当前cell一样的view 274 | - (UIView *)viewFromCell:(AppCollectionViewCell *)cell { 275 | 276 | UIView *view = [[UIView alloc] initWithFrame:cell.frame]; 277 | view.backgroundColor = RGB(230, 230, 230); 278 | 279 | UIImageView *appImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width/3, cell.frame.size.width/3)]; 280 | appImageView.image = cell.appImageView.image; 281 | appImageView.center = CGPointMake(cell.frame.size.width / 2.0, cell.frame.size.height / 2.0 - 10); 282 | [view addSubview:appImageView]; 283 | 284 | UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, 20)]; 285 | nameLabel.backgroundColor = [UIColor clearColor]; 286 | nameLabel.font = [UIFont boldSystemFontOfSize:12.0]; 287 | nameLabel.text = cell.nameLabel.text; 288 | nameLabel.textAlignment = NSTextAlignmentCenter; 289 | nameLabel.textColor = RGB(55, 55, 55); 290 | nameLabel.center = CGPointMake(cell.frame.size.width / 2.0, appImageView.frame.origin.y + appImageView.frame.size.height + nameLabel.frame.size.height / 2.0 + 3); 291 | [view addSubview:nameLabel]; 292 | 293 | 294 | UIButton *deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 295 | [deleteBtn setImage:[UIImage imageNamed:@"shanchu"] forState:UIControlStateNormal]; 296 | deleteBtn.frame = CGRectMake(cell.frame.size.width - 30, 0, 30, 30); 297 | deleteBtn.imageEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5); 298 | deleteBtn.hidden = NO; 299 | [view addSubview:deleteBtn]; 300 | 301 | return view; 302 | } 303 | 304 | #pragma mark - 根据生成的临时View转成image 305 | - (UIImage *)imageFromView:(UIView *)snapView { 306 | UIGraphicsBeginImageContext(snapView.frame.size); 307 | CGContextRef contextRef = UIGraphicsGetCurrentContext(); 308 | [snapView.layer renderInContext:contextRef]; 309 | UIImage *targetImage = UIGraphicsGetImageFromCurrentImageContext(); 310 | UIGraphicsEndImageContext(); 311 | return targetImage; 312 | } 313 | 314 | 315 | #pragma mark - UICollectionViewDataSource 316 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 317 | 318 | return _viewModels.count; 319 | } 320 | 321 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 322 | 323 | AppCollectionViewCell *cell = (AppCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath]; 324 | 325 | dataModel *model = _viewModels[indexPath.item]; 326 | [cell showInfoWithModel:model]; 327 | 328 | [cell.deleteBtn addTarget:self action:@selector(deleteButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; 329 | if (isEditing) { 330 | cell.deleteBtn.hidden = NO; 331 | } else { 332 | cell.deleteBtn.hidden = YES; 333 | } 334 | 335 | return cell; 336 | } 337 | 338 | #pragma mark - 按钮点击事件监听 339 | // 点击删除按钮,删除应用 340 | - (void)deleteButtonPressed:(id)sender{ 341 | AppCollectionViewCell *cell = (AppCollectionViewCell *)[sender superview].superview; 342 | NSIndexPath *indexPath = [_collectionView indexPathForCell:cell]; 343 | 344 | [_viewModels removeObjectAtIndex:indexPath.row]; 345 | 346 | [_collectionView reloadData]; 347 | } 348 | 349 | - (void)rightItemClick{ 350 | if (isEditing) { 351 | [self stopEditingModel]; 352 | } 353 | } 354 | 355 | // 点击添加按钮,随机添加数据 356 | - (void)leftItemClick { 357 | int x = arc4random() % _viewModels.count; 358 | dataModel *model = _viewModels[x]; 359 | 360 | [_viewModels addObject:model]; 361 | [_collectionView reloadData]; 362 | } 363 | 364 | @end 365 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/dataModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // dataModel.h 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/25. 6 | // Copyright © 2017年 weiguang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface dataModel : NSObject 12 | 13 | @property (nonatomic,strong) NSString *imageName; 14 | 15 | @property (nonatomic,strong) NSString *appName; 16 | 17 | 18 | +(instancetype)initWithDict:(NSDictionary *)dict; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/dataModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // dataModel.m 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/25. 6 | // Copyright © 2017年 weiguang. All rights reserved. 7 | // 8 | 9 | #import "dataModel.h" 10 | 11 | @implementation dataModel 12 | 13 | - (instancetype)initWith:(NSDictionary *)dict { 14 | 15 | self = [super init]; 16 | if (self) { 17 | [self setValuesForKeysWithDictionary:dict]; 18 | } 19 | 20 | return self; 21 | } 22 | 23 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key{ 24 | 25 | } 26 | 27 | +(instancetype)initWithDict:(NSDictionary *)dict{ 28 | 29 | return [[self alloc] initWith:dict]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /cell拖动添加删除/cell拖动添加删除/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // cell拖动添加删除 4 | // 5 | // Created by weiguang on 2017/5/24. 6 | // Copyright © 2017年 weiguang. 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 | --------------------------------------------------------------------------------