├── .gitignore ├── Example ├── HaidoraTableViewManager.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── HaidoraTableViewManager.xcworkspace │ └── contents.xcworkspacedata ├── HaidoraTableViewManager │ ├── Demo1 │ │ ├── Model │ │ │ ├── HDDemo1Model.h │ │ │ └── HDDemo1Model.m │ │ ├── View │ │ │ ├── HDDemo1TableViewCell.h │ │ │ ├── HDDemo1TableViewCell.m │ │ │ └── HDDemo1TableViewCell.xib │ │ └── ViewController │ │ │ ├── HDDemo1TableViewController.h │ │ │ └── HDDemo1TableViewController.m │ ├── Demo2 │ │ ├── View │ │ │ ├── HDDemo2Cell1.h │ │ │ ├── HDDemo2Cell1.m │ │ │ ├── HDDemo2Cell1.xib │ │ │ ├── HDDemo2Cell2.h │ │ │ ├── HDDemo2Cell2.m │ │ │ ├── HDDemo2Cell2.xib │ │ │ ├── HDDemo2Item1.h │ │ │ ├── HDDemo2Item1.m │ │ │ ├── HDDemo2Item2.h │ │ │ └── HDDemo2Item2.m │ │ └── ViewController │ │ │ ├── HDDemo2TableViewController.h │ │ │ └── HDDemo2TableViewController.m │ ├── DemoModule │ │ ├── Protocol │ │ │ ├── ButtonPresentable.h │ │ │ ├── ButtonPresentable.m │ │ │ ├── TitlePresentable.h │ │ │ └── TitlePresentable.m │ │ ├── ReadMe │ │ ├── View │ │ │ ├── HDDemoTableViewCell.h │ │ │ ├── HDDemoTableViewCell.m │ │ │ └── HDDemoTableViewCell.xib │ │ ├── ViewController │ │ │ ├── HDDemoTableViewController.h │ │ │ └── HDDemoTableViewController.m │ │ └── ViewModel │ │ │ ├── HDDemoViewModel.h │ │ │ └── HDDemoViewModel.m │ ├── HDAppDelegate.h │ ├── HDAppDelegate.m │ ├── HaidoraTableViewManager-Info.plist │ ├── HaidoraTableViewManager-Prefix.pch │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Launch Screen.storyboard │ ├── Main.storyboard │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m ├── Podfile ├── Podfile.lock └── Tests │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── en.lproj │ └── InfoPlist.strings ├── HaidoraTableViewManager.podspec ├── LICENSE ├── Pod ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── Cell │ ├── UITableViewCell+HDTableViewManager.h │ └── UITableViewCell+HDTableViewManager.m │ ├── Deprecated │ ├── HDTableViewItem+Deprecated.h │ ├── HDTableViewItem+Deprecated.m │ ├── HaidoraTableViewManagerDeprecated.h │ ├── UITableViewCell+Deprecated.h │ └── UITableViewCell+Deprecated.m │ ├── HDTableViewDefines.h │ ├── HaidoraTableViewManager.h │ ├── Item │ ├── HDTableViewItem.h │ └── HDTableViewItem.m │ ├── Manager │ ├── HDTableViewManager+HDPrivateUtils.h │ ├── HDTableViewManager+HDPrivateUtils.m │ ├── HDTableViewManager+UITableViewDataSource.h │ ├── HDTableViewManager+UITableViewDataSource.m │ ├── HDTableViewManager+UITableViewDelegate.h │ ├── HDTableViewManager+UITableViewDelegate.m │ ├── HDTableViewManager.h │ └── HDTableViewManager.m │ └── Section │ ├── HDTableViewSection.h │ └── HDTableViewSection.m ├── README.md └── _clang-format /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | *.xcscheme 27 | Example/Pods 28 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 57B05617C41BC9DB1A927A49 /* libPods-HaidoraTableViewManager_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 72554009243D2855FC50F458 /* libPods-HaidoraTableViewManager_Example.a */; }; 11 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 12 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 13 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 14 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; 15 | 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; 16 | 6003F59E195388D20070C39A /* HDAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* HDAppDelegate.m */; }; 17 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; 18 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; 19 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 20 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 21 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 22 | 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; 23 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; 24 | AB075D8B1C34C34100625CDB /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB075D8A1C34C34100625CDB /* Launch Screen.storyboard */; }; 25 | AB62B0F81C7C063A001CCE4E /* HDDemoTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = AB62B0F61C7C063A001CCE4E /* HDDemoTableViewCell.m */; }; 26 | AB62B0F91C7C063A001CCE4E /* HDDemoTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB62B0F71C7C063A001CCE4E /* HDDemoTableViewCell.xib */; }; 27 | AB62B0FD1C7C0650001CCE4E /* HDDemoTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB62B0FB1C7C0650001CCE4E /* HDDemoTableViewController.m */; }; 28 | AB62B1011C7C0663001CCE4E /* HDDemoViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = AB62B1001C7C0663001CCE4E /* HDDemoViewModel.m */; }; 29 | AB62B1051C7C06F1001CCE4E /* ReadMe in Resources */ = {isa = PBXBuildFile; fileRef = AB62B1041C7C06F1001CCE4E /* ReadMe */; }; 30 | AB62B1091C7C08A0001CCE4E /* TitlePresentable.m in Sources */ = {isa = PBXBuildFile; fileRef = AB62B1081C7C08A0001CCE4E /* TitlePresentable.m */; }; 31 | AB63DD8C1C8FB66100DB5595 /* HDDemo2TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB63DD8B1C8FB66100DB5595 /* HDDemo2TableViewController.m */; }; 32 | AB63DD8F1C8FB74F00DB5595 /* HDDemo2Item1.m in Sources */ = {isa = PBXBuildFile; fileRef = AB63DD8E1C8FB74F00DB5595 /* HDDemo2Item1.m */; }; 33 | AB63DD921C8FB75B00DB5595 /* HDDemo2Item2.m in Sources */ = {isa = PBXBuildFile; fileRef = AB63DD911C8FB75B00DB5595 /* HDDemo2Item2.m */; }; 34 | AB63DD961C8FB77600DB5595 /* HDDemo2Cell1.m in Sources */ = {isa = PBXBuildFile; fileRef = AB63DD941C8FB77600DB5595 /* HDDemo2Cell1.m */; }; 35 | AB63DD971C8FB77600DB5595 /* HDDemo2Cell1.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB63DD951C8FB77600DB5595 /* HDDemo2Cell1.xib */; }; 36 | AB63DD9B1C8FB78200DB5595 /* HDDemo2Cell2.m in Sources */ = {isa = PBXBuildFile; fileRef = AB63DD991C8FB78200DB5595 /* HDDemo2Cell2.m */; }; 37 | AB63DD9C1C8FB78200DB5595 /* HDDemo2Cell2.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB63DD9A1C8FB78200DB5595 /* HDDemo2Cell2.xib */; }; 38 | AB7480181C8ED8D800365F04 /* HDDemo1TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB7480171C8ED8D800365F04 /* HDDemo1TableViewController.m */; }; 39 | AB74801B1C8ED8FB00365F04 /* HDDemo1Model.m in Sources */ = {isa = PBXBuildFile; fileRef = AB74801A1C8ED8FB00365F04 /* HDDemo1Model.m */; }; 40 | AB74801E1C8ED91300365F04 /* HDDemo1TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = AB74801D1C8ED91300365F04 /* HDDemo1TableViewCell.m */; }; 41 | AB7480201C8ED91E00365F04 /* HDDemo1TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB74801F1C8ED91E00365F04 /* HDDemo1TableViewCell.xib */; }; 42 | ABFD20CC1C7C2B800046D116 /* ButtonPresentable.m in Sources */ = {isa = PBXBuildFile; fileRef = ABFD20CB1C7C2B800046D116 /* ButtonPresentable.m */; }; 43 | F865F96F1519D6187900A9A8 /* libPods-HaidoraTableViewManager_Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D4D515E706D45D271342AED /* libPods-HaidoraTableViewManager_Tests.a */; }; 44 | /* End PBXBuildFile section */ 45 | 46 | /* Begin PBXContainerItemProxy section */ 47 | 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { 48 | isa = PBXContainerItemProxy; 49 | containerPortal = 6003F582195388D10070C39A /* Project object */; 50 | proxyType = 1; 51 | remoteGlobalIDString = 6003F589195388D20070C39A; 52 | remoteInfo = HaidoraTableViewManager; 53 | }; 54 | /* End PBXContainerItemProxy section */ 55 | 56 | /* Begin PBXFileReference section */ 57 | 2C9F8F9264A4DCB3B46EE3E6 /* Pods-HaidoraTableViewManager_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HaidoraTableViewManager_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-HaidoraTableViewManager_Example/Pods-HaidoraTableViewManager_Example.release.xcconfig"; sourceTree = ""; }; 58 | 2D9D13352A0719CE58155E76 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 59 | 6003F58A195388D20070C39A /* HaidoraTableViewManager_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HaidoraTableViewManager_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 61 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 62 | 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 63 | 6003F595195388D20070C39A /* HaidoraTableViewManager-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "HaidoraTableViewManager-Info.plist"; sourceTree = ""; }; 64 | 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 65 | 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 66 | 6003F59B195388D20070C39A /* HaidoraTableViewManager-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HaidoraTableViewManager-Prefix.pch"; sourceTree = ""; }; 67 | 6003F59C195388D20070C39A /* HDAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDAppDelegate.h; sourceTree = ""; }; 68 | 6003F59D195388D20070C39A /* HDAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDAppDelegate.m; sourceTree = ""; }; 69 | 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 70 | 6003F5AE195388D20070C39A /* HaidoraTableViewManager_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HaidoraTableViewManager_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 72 | 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; 73 | 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 74 | 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; 75 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; 76 | 6AE802E70C7B5179F65B9E83 /* HaidoraTableViewManager.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = HaidoraTableViewManager.podspec; path = ../HaidoraTableViewManager.podspec; sourceTree = ""; }; 77 | 7115518C8ED25CF0F882099C /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 78 | 72554009243D2855FC50F458 /* libPods-HaidoraTableViewManager_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HaidoraTableViewManager_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 79 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 80 | 8D4D515E706D45D271342AED /* libPods-HaidoraTableViewManager_Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HaidoraTableViewManager_Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 81 | A2576A31CA9C394CD3CFEF7F /* Pods-HaidoraTableViewManager_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HaidoraTableViewManager_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-HaidoraTableViewManager_Tests/Pods-HaidoraTableViewManager_Tests.debug.xcconfig"; sourceTree = ""; }; 82 | AB075D8A1C34C34100625CDB /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 83 | AB62B0F51C7C063A001CCE4E /* HDDemoTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemoTableViewCell.h; sourceTree = ""; }; 84 | AB62B0F61C7C063A001CCE4E /* HDDemoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemoTableViewCell.m; sourceTree = ""; }; 85 | AB62B0F71C7C063A001CCE4E /* HDDemoTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HDDemoTableViewCell.xib; sourceTree = ""; }; 86 | AB62B0FA1C7C0650001CCE4E /* HDDemoTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemoTableViewController.h; sourceTree = ""; }; 87 | AB62B0FB1C7C0650001CCE4E /* HDDemoTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemoTableViewController.m; sourceTree = ""; }; 88 | AB62B0FF1C7C0663001CCE4E /* HDDemoViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemoViewModel.h; sourceTree = ""; }; 89 | AB62B1001C7C0663001CCE4E /* HDDemoViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemoViewModel.m; sourceTree = ""; }; 90 | AB62B1041C7C06F1001CCE4E /* ReadMe */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe; sourceTree = ""; }; 91 | AB62B1071C7C08A0001CCE4E /* TitlePresentable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TitlePresentable.h; sourceTree = ""; }; 92 | AB62B1081C7C08A0001CCE4E /* TitlePresentable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TitlePresentable.m; sourceTree = ""; }; 93 | AB63DD8A1C8FB66100DB5595 /* HDDemo2TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo2TableViewController.h; sourceTree = ""; }; 94 | AB63DD8B1C8FB66100DB5595 /* HDDemo2TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo2TableViewController.m; sourceTree = ""; }; 95 | AB63DD8D1C8FB74F00DB5595 /* HDDemo2Item1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo2Item1.h; sourceTree = ""; }; 96 | AB63DD8E1C8FB74F00DB5595 /* HDDemo2Item1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo2Item1.m; sourceTree = ""; }; 97 | AB63DD901C8FB75B00DB5595 /* HDDemo2Item2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo2Item2.h; sourceTree = ""; }; 98 | AB63DD911C8FB75B00DB5595 /* HDDemo2Item2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo2Item2.m; sourceTree = ""; }; 99 | AB63DD931C8FB77600DB5595 /* HDDemo2Cell1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo2Cell1.h; sourceTree = ""; }; 100 | AB63DD941C8FB77600DB5595 /* HDDemo2Cell1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo2Cell1.m; sourceTree = ""; }; 101 | AB63DD951C8FB77600DB5595 /* HDDemo2Cell1.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HDDemo2Cell1.xib; sourceTree = ""; }; 102 | AB63DD981C8FB78200DB5595 /* HDDemo2Cell2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo2Cell2.h; sourceTree = ""; }; 103 | AB63DD991C8FB78200DB5595 /* HDDemo2Cell2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo2Cell2.m; sourceTree = ""; }; 104 | AB63DD9A1C8FB78200DB5595 /* HDDemo2Cell2.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HDDemo2Cell2.xib; sourceTree = ""; }; 105 | AB7480161C8ED8D800365F04 /* HDDemo1TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo1TableViewController.h; sourceTree = ""; }; 106 | AB7480171C8ED8D800365F04 /* HDDemo1TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo1TableViewController.m; sourceTree = ""; }; 107 | AB7480191C8ED8FB00365F04 /* HDDemo1Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo1Model.h; sourceTree = ""; }; 108 | AB74801A1C8ED8FB00365F04 /* HDDemo1Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo1Model.m; sourceTree = ""; }; 109 | AB74801C1C8ED91300365F04 /* HDDemo1TableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDemo1TableViewCell.h; sourceTree = ""; }; 110 | AB74801D1C8ED91300365F04 /* HDDemo1TableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDDemo1TableViewCell.m; sourceTree = ""; }; 111 | AB74801F1C8ED91E00365F04 /* HDDemo1TableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HDDemo1TableViewCell.xib; sourceTree = ""; }; 112 | ABFD20CA1C7C2B800046D116 /* ButtonPresentable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonPresentable.h; sourceTree = ""; }; 113 | ABFD20CB1C7C2B800046D116 /* ButtonPresentable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ButtonPresentable.m; sourceTree = ""; }; 114 | C06DF38BF2E552ED3A88705D /* Pods-HaidoraTableViewManager_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HaidoraTableViewManager_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-HaidoraTableViewManager_Example/Pods-HaidoraTableViewManager_Example.debug.xcconfig"; sourceTree = ""; }; 115 | F312FCB8806669267C2130F2 /* Pods-HaidoraTableViewManager_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HaidoraTableViewManager_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-HaidoraTableViewManager_Tests/Pods-HaidoraTableViewManager_Tests.release.xcconfig"; sourceTree = ""; }; 116 | /* End PBXFileReference section */ 117 | 118 | /* Begin PBXFrameworksBuildPhase section */ 119 | 6003F587195388D20070C39A /* Frameworks */ = { 120 | isa = PBXFrameworksBuildPhase; 121 | buildActionMask = 2147483647; 122 | files = ( 123 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, 124 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, 125 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, 126 | 57B05617C41BC9DB1A927A49 /* libPods-HaidoraTableViewManager_Example.a in Frameworks */, 127 | ); 128 | runOnlyForDeploymentPostprocessing = 0; 129 | }; 130 | 6003F5AB195388D20070C39A /* Frameworks */ = { 131 | isa = PBXFrameworksBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, 135 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, 136 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, 137 | F865F96F1519D6187900A9A8 /* libPods-HaidoraTableViewManager_Tests.a in Frameworks */, 138 | ); 139 | runOnlyForDeploymentPostprocessing = 0; 140 | }; 141 | /* End PBXFrameworksBuildPhase section */ 142 | 143 | /* Begin PBXGroup section */ 144 | 6003F581195388D10070C39A = { 145 | isa = PBXGroup; 146 | children = ( 147 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, 148 | 6003F593195388D20070C39A /* Example for HaidoraTableViewManager */, 149 | 6003F5B5195388D20070C39A /* Tests */, 150 | 6003F58C195388D20070C39A /* Frameworks */, 151 | 6003F58B195388D20070C39A /* Products */, 152 | DA17DA1DD2A03C94BF6CBA6D /* Pods */, 153 | ); 154 | sourceTree = ""; 155 | }; 156 | 6003F58B195388D20070C39A /* Products */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 6003F58A195388D20070C39A /* HaidoraTableViewManager_Example.app */, 160 | 6003F5AE195388D20070C39A /* HaidoraTableViewManager_Tests.xctest */, 161 | ); 162 | name = Products; 163 | sourceTree = ""; 164 | }; 165 | 6003F58C195388D20070C39A /* Frameworks */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | 6003F58D195388D20070C39A /* Foundation.framework */, 169 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, 170 | 6003F591195388D20070C39A /* UIKit.framework */, 171 | 6003F5AF195388D20070C39A /* XCTest.framework */, 172 | 72554009243D2855FC50F458 /* libPods-HaidoraTableViewManager_Example.a */, 173 | 8D4D515E706D45D271342AED /* libPods-HaidoraTableViewManager_Tests.a */, 174 | ); 175 | name = Frameworks; 176 | sourceTree = ""; 177 | }; 178 | 6003F593195388D20070C39A /* Example for HaidoraTableViewManager */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | AB63DD861C8FB64300DB5595 /* Demo2 */, 182 | AB7480121C8ED8B900365F04 /* Demo1 */, 183 | AB62B0EC1C7C05FF001CCE4E /* DemoModule */, 184 | 6003F59C195388D20070C39A /* HDAppDelegate.h */, 185 | 6003F59D195388D20070C39A /* HDAppDelegate.m */, 186 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 187 | 6003F5A8195388D20070C39A /* Images.xcassets */, 188 | 6003F594195388D20070C39A /* Supporting Files */, 189 | ); 190 | name = "Example for HaidoraTableViewManager"; 191 | path = HaidoraTableViewManager; 192 | sourceTree = ""; 193 | }; 194 | 6003F594195388D20070C39A /* Supporting Files */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | 6003F595195388D20070C39A /* HaidoraTableViewManager-Info.plist */, 198 | 6003F596195388D20070C39A /* InfoPlist.strings */, 199 | 6003F599195388D20070C39A /* main.m */, 200 | 6003F59B195388D20070C39A /* HaidoraTableViewManager-Prefix.pch */, 201 | AB075D8A1C34C34100625CDB /* Launch Screen.storyboard */, 202 | ); 203 | name = "Supporting Files"; 204 | sourceTree = ""; 205 | }; 206 | 6003F5B5195388D20070C39A /* Tests */ = { 207 | isa = PBXGroup; 208 | children = ( 209 | 6003F5BB195388D20070C39A /* Tests.m */, 210 | 6003F5B6195388D20070C39A /* Supporting Files */, 211 | ); 212 | path = Tests; 213 | sourceTree = ""; 214 | }; 215 | 6003F5B6195388D20070C39A /* Supporting Files */ = { 216 | isa = PBXGroup; 217 | children = ( 218 | 6003F5B7195388D20070C39A /* Tests-Info.plist */, 219 | 6003F5B8195388D20070C39A /* InfoPlist.strings */, 220 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, 221 | ); 222 | name = "Supporting Files"; 223 | sourceTree = ""; 224 | }; 225 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { 226 | isa = PBXGroup; 227 | children = ( 228 | 6AE802E70C7B5179F65B9E83 /* HaidoraTableViewManager.podspec */, 229 | 2D9D13352A0719CE58155E76 /* README.md */, 230 | 7115518C8ED25CF0F882099C /* LICENSE */, 231 | ); 232 | name = "Podspec Metadata"; 233 | sourceTree = ""; 234 | }; 235 | AB62B0EC1C7C05FF001CCE4E /* DemoModule */ = { 236 | isa = PBXGroup; 237 | children = ( 238 | AB62B1021C7C068F001CCE4E /* Protocol */, 239 | AB62B0ED1C7C05FF001CCE4E /* View */, 240 | AB62B0EE1C7C05FF001CCE4E /* ViewController */, 241 | AB62B0EF1C7C05FF001CCE4E /* ViewModel */, 242 | AB62B1041C7C06F1001CCE4E /* ReadMe */, 243 | ); 244 | path = DemoModule; 245 | sourceTree = ""; 246 | }; 247 | AB62B0ED1C7C05FF001CCE4E /* View */ = { 248 | isa = PBXGroup; 249 | children = ( 250 | AB62B0F51C7C063A001CCE4E /* HDDemoTableViewCell.h */, 251 | AB62B0F61C7C063A001CCE4E /* HDDemoTableViewCell.m */, 252 | AB62B0F71C7C063A001CCE4E /* HDDemoTableViewCell.xib */, 253 | ); 254 | path = View; 255 | sourceTree = ""; 256 | }; 257 | AB62B0EE1C7C05FF001CCE4E /* ViewController */ = { 258 | isa = PBXGroup; 259 | children = ( 260 | AB62B0FA1C7C0650001CCE4E /* HDDemoTableViewController.h */, 261 | AB62B0FB1C7C0650001CCE4E /* HDDemoTableViewController.m */, 262 | ); 263 | path = ViewController; 264 | sourceTree = ""; 265 | }; 266 | AB62B0EF1C7C05FF001CCE4E /* ViewModel */ = { 267 | isa = PBXGroup; 268 | children = ( 269 | AB62B0FF1C7C0663001CCE4E /* HDDemoViewModel.h */, 270 | AB62B1001C7C0663001CCE4E /* HDDemoViewModel.m */, 271 | ); 272 | path = ViewModel; 273 | sourceTree = ""; 274 | }; 275 | AB62B1021C7C068F001CCE4E /* Protocol */ = { 276 | isa = PBXGroup; 277 | children = ( 278 | AB62B1071C7C08A0001CCE4E /* TitlePresentable.h */, 279 | AB62B1081C7C08A0001CCE4E /* TitlePresentable.m */, 280 | ABFD20CA1C7C2B800046D116 /* ButtonPresentable.h */, 281 | ABFD20CB1C7C2B800046D116 /* ButtonPresentable.m */, 282 | ); 283 | path = Protocol; 284 | sourceTree = ""; 285 | }; 286 | AB63DD861C8FB64300DB5595 /* Demo2 */ = { 287 | isa = PBXGroup; 288 | children = ( 289 | AB63DD871C8FB64300DB5595 /* Model */, 290 | AB63DD881C8FB64300DB5595 /* View */, 291 | AB63DD891C8FB64300DB5595 /* ViewController */, 292 | ); 293 | path = Demo2; 294 | sourceTree = ""; 295 | }; 296 | AB63DD871C8FB64300DB5595 /* Model */ = { 297 | isa = PBXGroup; 298 | children = ( 299 | ); 300 | path = Model; 301 | sourceTree = ""; 302 | }; 303 | AB63DD881C8FB64300DB5595 /* View */ = { 304 | isa = PBXGroup; 305 | children = ( 306 | AB63DD8D1C8FB74F00DB5595 /* HDDemo2Item1.h */, 307 | AB63DD8E1C8FB74F00DB5595 /* HDDemo2Item1.m */, 308 | AB63DD901C8FB75B00DB5595 /* HDDemo2Item2.h */, 309 | AB63DD911C8FB75B00DB5595 /* HDDemo2Item2.m */, 310 | AB63DD931C8FB77600DB5595 /* HDDemo2Cell1.h */, 311 | AB63DD941C8FB77600DB5595 /* HDDemo2Cell1.m */, 312 | AB63DD951C8FB77600DB5595 /* HDDemo2Cell1.xib */, 313 | AB63DD981C8FB78200DB5595 /* HDDemo2Cell2.h */, 314 | AB63DD991C8FB78200DB5595 /* HDDemo2Cell2.m */, 315 | AB63DD9A1C8FB78200DB5595 /* HDDemo2Cell2.xib */, 316 | ); 317 | path = View; 318 | sourceTree = ""; 319 | }; 320 | AB63DD891C8FB64300DB5595 /* ViewController */ = { 321 | isa = PBXGroup; 322 | children = ( 323 | AB63DD8A1C8FB66100DB5595 /* HDDemo2TableViewController.h */, 324 | AB63DD8B1C8FB66100DB5595 /* HDDemo2TableViewController.m */, 325 | ); 326 | path = ViewController; 327 | sourceTree = ""; 328 | }; 329 | AB7480121C8ED8B900365F04 /* Demo1 */ = { 330 | isa = PBXGroup; 331 | children = ( 332 | AB7480131C8ED8B900365F04 /* Model */, 333 | AB7480141C8ED8B900365F04 /* View */, 334 | AB7480151C8ED8B900365F04 /* ViewController */, 335 | ); 336 | path = Demo1; 337 | sourceTree = ""; 338 | }; 339 | AB7480131C8ED8B900365F04 /* Model */ = { 340 | isa = PBXGroup; 341 | children = ( 342 | AB7480191C8ED8FB00365F04 /* HDDemo1Model.h */, 343 | AB74801A1C8ED8FB00365F04 /* HDDemo1Model.m */, 344 | ); 345 | path = Model; 346 | sourceTree = ""; 347 | }; 348 | AB7480141C8ED8B900365F04 /* View */ = { 349 | isa = PBXGroup; 350 | children = ( 351 | AB74801C1C8ED91300365F04 /* HDDemo1TableViewCell.h */, 352 | AB74801D1C8ED91300365F04 /* HDDemo1TableViewCell.m */, 353 | AB74801F1C8ED91E00365F04 /* HDDemo1TableViewCell.xib */, 354 | ); 355 | path = View; 356 | sourceTree = ""; 357 | }; 358 | AB7480151C8ED8B900365F04 /* ViewController */ = { 359 | isa = PBXGroup; 360 | children = ( 361 | AB7480161C8ED8D800365F04 /* HDDemo1TableViewController.h */, 362 | AB7480171C8ED8D800365F04 /* HDDemo1TableViewController.m */, 363 | ); 364 | path = ViewController; 365 | sourceTree = ""; 366 | }; 367 | DA17DA1DD2A03C94BF6CBA6D /* Pods */ = { 368 | isa = PBXGroup; 369 | children = ( 370 | C06DF38BF2E552ED3A88705D /* Pods-HaidoraTableViewManager_Example.debug.xcconfig */, 371 | 2C9F8F9264A4DCB3B46EE3E6 /* Pods-HaidoraTableViewManager_Example.release.xcconfig */, 372 | A2576A31CA9C394CD3CFEF7F /* Pods-HaidoraTableViewManager_Tests.debug.xcconfig */, 373 | F312FCB8806669267C2130F2 /* Pods-HaidoraTableViewManager_Tests.release.xcconfig */, 374 | ); 375 | name = Pods; 376 | sourceTree = ""; 377 | }; 378 | /* End PBXGroup section */ 379 | 380 | /* Begin PBXNativeTarget section */ 381 | 6003F589195388D20070C39A /* HaidoraTableViewManager_Example */ = { 382 | isa = PBXNativeTarget; 383 | buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "HaidoraTableViewManager_Example" */; 384 | buildPhases = ( 385 | 0B31FE3A475F6658C649520C /* Check Pods Manifest.lock */, 386 | 6003F586195388D20070C39A /* Sources */, 387 | 6003F587195388D20070C39A /* Frameworks */, 388 | 6003F588195388D20070C39A /* Resources */, 389 | 4D07C70F87F31D47450EB930 /* Copy Pods Resources */, 390 | FFA22A0793A6541B8F596693 /* Embed Pods Frameworks */, 391 | ); 392 | buildRules = ( 393 | ); 394 | dependencies = ( 395 | ); 396 | name = HaidoraTableViewManager_Example; 397 | productName = HaidoraTableViewManager; 398 | productReference = 6003F58A195388D20070C39A /* HaidoraTableViewManager_Example.app */; 399 | productType = "com.apple.product-type.application"; 400 | }; 401 | 6003F5AD195388D20070C39A /* HaidoraTableViewManager_Tests */ = { 402 | isa = PBXNativeTarget; 403 | buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "HaidoraTableViewManager_Tests" */; 404 | buildPhases = ( 405 | F78D84BD6BBBCA173DE25BD7 /* Check Pods Manifest.lock */, 406 | 6003F5AA195388D20070C39A /* Sources */, 407 | 6003F5AB195388D20070C39A /* Frameworks */, 408 | 6003F5AC195388D20070C39A /* Resources */, 409 | C671C947EF80E9D272B43BE4 /* Copy Pods Resources */, 410 | 0FC8760AE3DAD382CF3A809E /* Embed Pods Frameworks */, 411 | ); 412 | buildRules = ( 413 | ); 414 | dependencies = ( 415 | 6003F5B4195388D20070C39A /* PBXTargetDependency */, 416 | ); 417 | name = HaidoraTableViewManager_Tests; 418 | productName = HaidoraTableViewManagerTests; 419 | productReference = 6003F5AE195388D20070C39A /* HaidoraTableViewManager_Tests.xctest */; 420 | productType = "com.apple.product-type.bundle.unit-test"; 421 | }; 422 | /* End PBXNativeTarget section */ 423 | 424 | /* Begin PBXProject section */ 425 | 6003F582195388D10070C39A /* Project object */ = { 426 | isa = PBXProject; 427 | attributes = { 428 | CLASSPREFIX = HD; 429 | LastSwiftUpdateCheck = 0730; 430 | LastUpgradeCheck = 0720; 431 | ORGANIZATIONNAME = mrdaios; 432 | TargetAttributes = { 433 | 6003F5AD195388D20070C39A = { 434 | TestTargetID = 6003F589195388D20070C39A; 435 | }; 436 | }; 437 | }; 438 | buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "HaidoraTableViewManager" */; 439 | compatibilityVersion = "Xcode 3.2"; 440 | developmentRegion = English; 441 | hasScannedForEncodings = 0; 442 | knownRegions = ( 443 | en, 444 | Base, 445 | ); 446 | mainGroup = 6003F581195388D10070C39A; 447 | productRefGroup = 6003F58B195388D20070C39A /* Products */; 448 | projectDirPath = ""; 449 | projectRoot = ""; 450 | targets = ( 451 | 6003F589195388D20070C39A /* HaidoraTableViewManager_Example */, 452 | 6003F5AD195388D20070C39A /* HaidoraTableViewManager_Tests */, 453 | ); 454 | }; 455 | /* End PBXProject section */ 456 | 457 | /* Begin PBXResourcesBuildPhase section */ 458 | 6003F588195388D20070C39A /* Resources */ = { 459 | isa = PBXResourcesBuildPhase; 460 | buildActionMask = 2147483647; 461 | files = ( 462 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */, 463 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, 464 | AB075D8B1C34C34100625CDB /* Launch Screen.storyboard in Resources */, 465 | AB7480201C8ED91E00365F04 /* HDDemo1TableViewCell.xib in Resources */, 466 | AB63DD9C1C8FB78200DB5595 /* HDDemo2Cell2.xib in Resources */, 467 | AB62B1051C7C06F1001CCE4E /* ReadMe in Resources */, 468 | AB63DD971C8FB77600DB5595 /* HDDemo2Cell1.xib in Resources */, 469 | AB62B0F91C7C063A001CCE4E /* HDDemoTableViewCell.xib in Resources */, 470 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, 471 | ); 472 | runOnlyForDeploymentPostprocessing = 0; 473 | }; 474 | 6003F5AC195388D20070C39A /* Resources */ = { 475 | isa = PBXResourcesBuildPhase; 476 | buildActionMask = 2147483647; 477 | files = ( 478 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, 479 | ); 480 | runOnlyForDeploymentPostprocessing = 0; 481 | }; 482 | /* End PBXResourcesBuildPhase section */ 483 | 484 | /* Begin PBXShellScriptBuildPhase section */ 485 | 0B31FE3A475F6658C649520C /* Check Pods Manifest.lock */ = { 486 | isa = PBXShellScriptBuildPhase; 487 | buildActionMask = 2147483647; 488 | files = ( 489 | ); 490 | inputPaths = ( 491 | ); 492 | name = "Check Pods Manifest.lock"; 493 | outputPaths = ( 494 | ); 495 | runOnlyForDeploymentPostprocessing = 0; 496 | shellPath = /bin/sh; 497 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 498 | showEnvVarsInLog = 0; 499 | }; 500 | 0FC8760AE3DAD382CF3A809E /* Embed Pods Frameworks */ = { 501 | isa = PBXShellScriptBuildPhase; 502 | buildActionMask = 2147483647; 503 | files = ( 504 | ); 505 | inputPaths = ( 506 | ); 507 | name = "Embed Pods Frameworks"; 508 | outputPaths = ( 509 | ); 510 | runOnlyForDeploymentPostprocessing = 0; 511 | shellPath = /bin/sh; 512 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HaidoraTableViewManager_Tests/Pods-HaidoraTableViewManager_Tests-frameworks.sh\"\n"; 513 | showEnvVarsInLog = 0; 514 | }; 515 | 4D07C70F87F31D47450EB930 /* Copy Pods Resources */ = { 516 | isa = PBXShellScriptBuildPhase; 517 | buildActionMask = 2147483647; 518 | files = ( 519 | ); 520 | inputPaths = ( 521 | ); 522 | name = "Copy Pods Resources"; 523 | outputPaths = ( 524 | ); 525 | runOnlyForDeploymentPostprocessing = 0; 526 | shellPath = /bin/sh; 527 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HaidoraTableViewManager_Example/Pods-HaidoraTableViewManager_Example-resources.sh\"\n"; 528 | showEnvVarsInLog = 0; 529 | }; 530 | C671C947EF80E9D272B43BE4 /* Copy Pods Resources */ = { 531 | isa = PBXShellScriptBuildPhase; 532 | buildActionMask = 2147483647; 533 | files = ( 534 | ); 535 | inputPaths = ( 536 | ); 537 | name = "Copy Pods Resources"; 538 | outputPaths = ( 539 | ); 540 | runOnlyForDeploymentPostprocessing = 0; 541 | shellPath = /bin/sh; 542 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HaidoraTableViewManager_Tests/Pods-HaidoraTableViewManager_Tests-resources.sh\"\n"; 543 | showEnvVarsInLog = 0; 544 | }; 545 | F78D84BD6BBBCA173DE25BD7 /* Check Pods Manifest.lock */ = { 546 | isa = PBXShellScriptBuildPhase; 547 | buildActionMask = 2147483647; 548 | files = ( 549 | ); 550 | inputPaths = ( 551 | ); 552 | name = "Check Pods Manifest.lock"; 553 | outputPaths = ( 554 | ); 555 | runOnlyForDeploymentPostprocessing = 0; 556 | shellPath = /bin/sh; 557 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 558 | showEnvVarsInLog = 0; 559 | }; 560 | FFA22A0793A6541B8F596693 /* Embed Pods Frameworks */ = { 561 | isa = PBXShellScriptBuildPhase; 562 | buildActionMask = 2147483647; 563 | files = ( 564 | ); 565 | inputPaths = ( 566 | ); 567 | name = "Embed Pods Frameworks"; 568 | outputPaths = ( 569 | ); 570 | runOnlyForDeploymentPostprocessing = 0; 571 | shellPath = /bin/sh; 572 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HaidoraTableViewManager_Example/Pods-HaidoraTableViewManager_Example-frameworks.sh\"\n"; 573 | showEnvVarsInLog = 0; 574 | }; 575 | /* End PBXShellScriptBuildPhase section */ 576 | 577 | /* Begin PBXSourcesBuildPhase section */ 578 | 6003F586195388D20070C39A /* Sources */ = { 579 | isa = PBXSourcesBuildPhase; 580 | buildActionMask = 2147483647; 581 | files = ( 582 | AB7480181C8ED8D800365F04 /* HDDemo1TableViewController.m in Sources */, 583 | AB63DD9B1C8FB78200DB5595 /* HDDemo2Cell2.m in Sources */, 584 | AB62B1011C7C0663001CCE4E /* HDDemoViewModel.m in Sources */, 585 | AB74801E1C8ED91300365F04 /* HDDemo1TableViewCell.m in Sources */, 586 | 6003F59E195388D20070C39A /* HDAppDelegate.m in Sources */, 587 | AB63DD8F1C8FB74F00DB5595 /* HDDemo2Item1.m in Sources */, 588 | AB63DD921C8FB75B00DB5595 /* HDDemo2Item2.m in Sources */, 589 | AB62B1091C7C08A0001CCE4E /* TitlePresentable.m in Sources */, 590 | 6003F59A195388D20070C39A /* main.m in Sources */, 591 | AB62B0F81C7C063A001CCE4E /* HDDemoTableViewCell.m in Sources */, 592 | AB74801B1C8ED8FB00365F04 /* HDDemo1Model.m in Sources */, 593 | AB62B0FD1C7C0650001CCE4E /* HDDemoTableViewController.m in Sources */, 594 | AB63DD8C1C8FB66100DB5595 /* HDDemo2TableViewController.m in Sources */, 595 | ABFD20CC1C7C2B800046D116 /* ButtonPresentable.m in Sources */, 596 | AB63DD961C8FB77600DB5595 /* HDDemo2Cell1.m in Sources */, 597 | ); 598 | runOnlyForDeploymentPostprocessing = 0; 599 | }; 600 | 6003F5AA195388D20070C39A /* Sources */ = { 601 | isa = PBXSourcesBuildPhase; 602 | buildActionMask = 2147483647; 603 | files = ( 604 | 6003F5BC195388D20070C39A /* Tests.m in Sources */, 605 | ); 606 | runOnlyForDeploymentPostprocessing = 0; 607 | }; 608 | /* End PBXSourcesBuildPhase section */ 609 | 610 | /* Begin PBXTargetDependency section */ 611 | 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { 612 | isa = PBXTargetDependency; 613 | target = 6003F589195388D20070C39A /* HaidoraTableViewManager_Example */; 614 | targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; 615 | }; 616 | /* End PBXTargetDependency section */ 617 | 618 | /* Begin PBXVariantGroup section */ 619 | 6003F596195388D20070C39A /* InfoPlist.strings */ = { 620 | isa = PBXVariantGroup; 621 | children = ( 622 | 6003F597195388D20070C39A /* en */, 623 | ); 624 | name = InfoPlist.strings; 625 | sourceTree = ""; 626 | }; 627 | 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { 628 | isa = PBXVariantGroup; 629 | children = ( 630 | 6003F5B9195388D20070C39A /* en */, 631 | ); 632 | name = InfoPlist.strings; 633 | sourceTree = ""; 634 | }; 635 | /* End PBXVariantGroup section */ 636 | 637 | /* Begin XCBuildConfiguration section */ 638 | 6003F5BD195388D20070C39A /* Debug */ = { 639 | isa = XCBuildConfiguration; 640 | buildSettings = { 641 | ALWAYS_SEARCH_USER_PATHS = NO; 642 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 643 | CLANG_CXX_LIBRARY = "libc++"; 644 | CLANG_ENABLE_MODULES = YES; 645 | CLANG_ENABLE_OBJC_ARC = YES; 646 | CLANG_WARN_BOOL_CONVERSION = YES; 647 | CLANG_WARN_CONSTANT_CONVERSION = YES; 648 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 649 | CLANG_WARN_EMPTY_BODY = YES; 650 | CLANG_WARN_ENUM_CONVERSION = YES; 651 | CLANG_WARN_INT_CONVERSION = YES; 652 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 653 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 654 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 655 | COPY_PHASE_STRIP = NO; 656 | ENABLE_TESTABILITY = YES; 657 | GCC_C_LANGUAGE_STANDARD = gnu99; 658 | GCC_DYNAMIC_NO_PIC = NO; 659 | GCC_OPTIMIZATION_LEVEL = 0; 660 | GCC_PREPROCESSOR_DEFINITIONS = ( 661 | "DEBUG=1", 662 | "$(inherited)", 663 | ); 664 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 665 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 666 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 667 | GCC_WARN_UNDECLARED_SELECTOR = YES; 668 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 669 | GCC_WARN_UNUSED_FUNCTION = YES; 670 | GCC_WARN_UNUSED_VARIABLE = YES; 671 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 672 | ONLY_ACTIVE_ARCH = YES; 673 | SDKROOT = iphoneos; 674 | TARGETED_DEVICE_FAMILY = "1,2"; 675 | }; 676 | name = Debug; 677 | }; 678 | 6003F5BE195388D20070C39A /* Release */ = { 679 | isa = XCBuildConfiguration; 680 | buildSettings = { 681 | ALWAYS_SEARCH_USER_PATHS = NO; 682 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 683 | CLANG_CXX_LIBRARY = "libc++"; 684 | CLANG_ENABLE_MODULES = YES; 685 | CLANG_ENABLE_OBJC_ARC = YES; 686 | CLANG_WARN_BOOL_CONVERSION = YES; 687 | CLANG_WARN_CONSTANT_CONVERSION = YES; 688 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 689 | CLANG_WARN_EMPTY_BODY = YES; 690 | CLANG_WARN_ENUM_CONVERSION = YES; 691 | CLANG_WARN_INT_CONVERSION = YES; 692 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 693 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 694 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 695 | COPY_PHASE_STRIP = YES; 696 | ENABLE_NS_ASSERTIONS = NO; 697 | GCC_C_LANGUAGE_STANDARD = gnu99; 698 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 699 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 700 | GCC_WARN_UNDECLARED_SELECTOR = YES; 701 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 702 | GCC_WARN_UNUSED_FUNCTION = YES; 703 | GCC_WARN_UNUSED_VARIABLE = YES; 704 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 705 | SDKROOT = iphoneos; 706 | TARGETED_DEVICE_FAMILY = "1,2"; 707 | VALIDATE_PRODUCT = YES; 708 | }; 709 | name = Release; 710 | }; 711 | 6003F5C0195388D20070C39A /* Debug */ = { 712 | isa = XCBuildConfiguration; 713 | baseConfigurationReference = C06DF38BF2E552ED3A88705D /* Pods-HaidoraTableViewManager_Example.debug.xcconfig */; 714 | buildSettings = { 715 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 716 | CLANG_ENABLE_MODULES = YES; 717 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 718 | GCC_PREFIX_HEADER = "HaidoraTableViewManager/HaidoraTableViewManager-Prefix.pch"; 719 | INFOPLIST_FILE = "HaidoraTableViewManager/HaidoraTableViewManager-Info.plist"; 720 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 721 | MODULE_NAME = ExampleApp; 722 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 723 | PRODUCT_NAME = "$(TARGET_NAME)"; 724 | SWIFT_OBJC_BRIDGING_HEADER = "HaidoraTableViewManager/DemoModule/View/HaidoraTableViewManager_Example-Bridging-Header.h"; 725 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 726 | WRAPPER_EXTENSION = app; 727 | }; 728 | name = Debug; 729 | }; 730 | 6003F5C1195388D20070C39A /* Release */ = { 731 | isa = XCBuildConfiguration; 732 | baseConfigurationReference = 2C9F8F9264A4DCB3B46EE3E6 /* Pods-HaidoraTableViewManager_Example.release.xcconfig */; 733 | buildSettings = { 734 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 735 | CLANG_ENABLE_MODULES = YES; 736 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 737 | GCC_PREFIX_HEADER = "HaidoraTableViewManager/HaidoraTableViewManager-Prefix.pch"; 738 | INFOPLIST_FILE = "HaidoraTableViewManager/HaidoraTableViewManager-Info.plist"; 739 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 740 | MODULE_NAME = ExampleApp; 741 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 742 | PRODUCT_NAME = "$(TARGET_NAME)"; 743 | SWIFT_OBJC_BRIDGING_HEADER = "HaidoraTableViewManager/DemoModule/View/HaidoraTableViewManager_Example-Bridging-Header.h"; 744 | WRAPPER_EXTENSION = app; 745 | }; 746 | name = Release; 747 | }; 748 | 6003F5C3195388D20070C39A /* Debug */ = { 749 | isa = XCBuildConfiguration; 750 | baseConfigurationReference = A2576A31CA9C394CD3CFEF7F /* Pods-HaidoraTableViewManager_Tests.debug.xcconfig */; 751 | buildSettings = { 752 | BUNDLE_LOADER = "$(TEST_HOST)"; 753 | FRAMEWORK_SEARCH_PATHS = ( 754 | "$(SDKROOT)/Developer/Library/Frameworks", 755 | "$(inherited)", 756 | "$(DEVELOPER_FRAMEWORKS_DIR)", 757 | ); 758 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 759 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 760 | GCC_PREPROCESSOR_DEFINITIONS = ( 761 | "DEBUG=1", 762 | "$(inherited)", 763 | ); 764 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 765 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 766 | PRODUCT_NAME = "$(TARGET_NAME)"; 767 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HaidoraTableViewManager_Example.app/HaidoraTableViewManager_Example"; 768 | WRAPPER_EXTENSION = xctest; 769 | }; 770 | name = Debug; 771 | }; 772 | 6003F5C4195388D20070C39A /* Release */ = { 773 | isa = XCBuildConfiguration; 774 | baseConfigurationReference = F312FCB8806669267C2130F2 /* Pods-HaidoraTableViewManager_Tests.release.xcconfig */; 775 | buildSettings = { 776 | BUNDLE_LOADER = "$(TEST_HOST)"; 777 | FRAMEWORK_SEARCH_PATHS = ( 778 | "$(SDKROOT)/Developer/Library/Frameworks", 779 | "$(inherited)", 780 | "$(DEVELOPER_FRAMEWORKS_DIR)", 781 | ); 782 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 783 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 784 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 785 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 786 | PRODUCT_NAME = "$(TARGET_NAME)"; 787 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HaidoraTableViewManager_Example.app/HaidoraTableViewManager_Example"; 788 | WRAPPER_EXTENSION = xctest; 789 | }; 790 | name = Release; 791 | }; 792 | /* End XCBuildConfiguration section */ 793 | 794 | /* Begin XCConfigurationList section */ 795 | 6003F585195388D10070C39A /* Build configuration list for PBXProject "HaidoraTableViewManager" */ = { 796 | isa = XCConfigurationList; 797 | buildConfigurations = ( 798 | 6003F5BD195388D20070C39A /* Debug */, 799 | 6003F5BE195388D20070C39A /* Release */, 800 | ); 801 | defaultConfigurationIsVisible = 0; 802 | defaultConfigurationName = Release; 803 | }; 804 | 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "HaidoraTableViewManager_Example" */ = { 805 | isa = XCConfigurationList; 806 | buildConfigurations = ( 807 | 6003F5C0195388D20070C39A /* Debug */, 808 | 6003F5C1195388D20070C39A /* Release */, 809 | ); 810 | defaultConfigurationIsVisible = 0; 811 | defaultConfigurationName = Release; 812 | }; 813 | 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "HaidoraTableViewManager_Tests" */ = { 814 | isa = XCConfigurationList; 815 | buildConfigurations = ( 816 | 6003F5C3195388D20070C39A /* Debug */, 817 | 6003F5C4195388D20070C39A /* Release */, 818 | ); 819 | defaultConfigurationIsVisible = 0; 820 | defaultConfigurationName = Release; 821 | }; 822 | /* End XCConfigurationList section */ 823 | }; 824 | rootObject = 6003F582195388D10070C39A /* Project object */; 825 | } 826 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo1/Model/HDDemo1Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo1Model.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/8. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDDemo1Model : NSObject 12 | 13 | @property (nonatomic, copy) NSString *info1; 14 | @property (nonatomic, copy) NSString *info2; 15 | 16 | - (id)initWith:(NSString *)info1 info2:(NSString *)info2; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo1/Model/HDDemo1Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo1Model.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/8. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemo1Model.h" 10 | 11 | @implementation HDDemo1Model 12 | 13 | - (id)initWith:(NSString *)info1 info2:(NSString *)info2 14 | { 15 | self = [self init]; 16 | if (self) 17 | { 18 | self.info1 = info1; 19 | self.info2 = info2; 20 | } 21 | return self; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo1/View/HDDemo1TableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo1TableViewCell.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/8. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDDemo1TableViewCell : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo1/View/HDDemo1TableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo1TableViewCell.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/8. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemo1Model.h" 10 | #import "HDDemo1TableViewCell.h" 11 | 12 | @interface HDDemo1TableViewCell () 13 | 14 | @property (weak, nonatomic) IBOutlet UILabel *label1; 15 | @property (weak, nonatomic) IBOutlet UILabel *label2; 16 | 17 | @end 18 | 19 | @implementation HDDemo1TableViewCell 20 | 21 | - (void)hd_setContent:(HDDemo1Model *)content 22 | { 23 | _label1.text = content.info1; 24 | _label2.text = content.info2; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo1/View/HDDemo1TableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo1/ViewController/HDDemo1TableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo1TableViewController.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/8. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 常用的模式 13 | */ 14 | @interface HDDemo1TableViewController : UITableViewController 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo1/ViewController/HDDemo1TableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo1TableViewController.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/8. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemo1Model.h" 10 | #import "HDDemo1TableViewCell.h" 11 | #import "HDDemo1TableViewController.h" 12 | 13 | @interface HDDemo1TableViewController () 14 | 15 | @property (nonatomic, strong) HDTableViewManager *manager; 16 | @property (nonatomic, strong) HDTableViewSection *section; 17 | 18 | @end 19 | 20 | @implementation HDDemo1TableViewController 21 | 22 | #pragma mark 23 | #pragma mark Init 24 | 25 | #pragma mark 26 | #pragma mark Life Cycle 27 | 28 | - (void)viewDidLoad 29 | { 30 | [super viewDidLoad]; 31 | [self prepareForData]; 32 | [self prepareForView]; 33 | [self prepareForAction]; 34 | } 35 | 36 | - (void)viewWillAppear:(BOOL)animated 37 | { 38 | [super viewWillAppear:animated]; 39 | } 40 | 41 | - (void)viewDidAppear:(BOOL)animated 42 | { 43 | [super viewDidAppear:animated]; 44 | } 45 | 46 | - (void)viewDidDisappear:(BOOL)animated 47 | { 48 | [super viewDidDisappear:animated]; 49 | } 50 | 51 | #pragma mark 52 | #pragma mark PrepareConfig 53 | 54 | - (void)prepareForData 55 | { 56 | //根据需求配置相关属性 57 | self.manager.cellClass = [HDDemo1TableViewCell class]; 58 | 59 | [self.manager.sections addObject:self.section]; 60 | } 61 | 62 | - (void)prepareForView 63 | { 64 | // TableView的配置交给manager,ViewController减少dataSource和delegate 65 | self.tableView.dataSource = self.manager; 66 | self.tableView.delegate = self.manager; 67 | } 68 | 69 | - (void)prepareForAction 70 | { 71 | UIBarButtonItem *barItem = 72 | [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 73 | target:self 74 | action:@selector(demo:)]; 75 | self.navigationItem.rightBarButtonItem = barItem; 76 | } 77 | 78 | #pragma mark 79 | #pragma mark XXXDelegate 80 | 81 | #pragma mark 82 | #pragma mark Event Response 83 | 84 | - (void)demo:(id)sender 85 | { 86 | __weak typeof(self) weakSelf = self; 87 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ 88 | 89 | sleep(1); 90 | //模拟网络,数据库等取数据 91 | [weakSelf.section.items removeAllObjects]; 92 | for (NSInteger index = 0; index < 10; index++) 93 | { 94 | HDDemo1Model *model = 95 | [[HDDemo1Model alloc] initWith:[NSString stringWithFormat:@"info1-%@", @(index)] 96 | info2:[NSString stringWithFormat:@"info2-%@", @(index)]]; 97 | //添加数据 98 | [weakSelf.section.items addObject:model]; 99 | } 100 | dispatch_async(dispatch_get_main_queue(), ^{ 101 | [weakSelf.tableView reloadData]; 102 | }); 103 | }); 104 | } 105 | 106 | #pragma mark 107 | #pragma mark Getter/Setter 108 | 109 | - (HDTableViewManager *)manager 110 | { 111 | if (nil == _manager) 112 | { 113 | _manager = [HDTableViewManager manager]; 114 | } 115 | return _manager; 116 | } 117 | 118 | - (HDTableViewSection *)section 119 | { 120 | if (nil == _section) 121 | { 122 | _section = [[HDTableViewSection alloc] init]; 123 | } 124 | return _section; 125 | } 126 | 127 | @end 128 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Cell1.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Cell1.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDDemo2Cell1 : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Cell1.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Cell1.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemo2Cell1.h" 10 | 11 | @implementation HDDemo2Cell1 12 | 13 | - (void)awakeFromNib 14 | { 15 | // Initialization code 16 | } 17 | 18 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 19 | { 20 | [super setSelected:selected animated:animated]; 21 | 22 | // Configure the view for the selected state 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Cell1.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Cell2.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Cell2.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDDemo2Cell2 : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Cell2.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Cell2.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemo2Cell2.h" 10 | 11 | @implementation HDDemo2Cell2 12 | 13 | - (void)awakeFromNib 14 | { 15 | // Initialization code 16 | } 17 | 18 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 19 | { 20 | [super setSelected:selected animated:animated]; 21 | 22 | // Configure the view for the selected state 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Cell2.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Item1.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Item1.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDDemo2Item1 : HDTableViewItem 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Item1.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Item1.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemo2Cell1.h" 10 | #import "HDDemo2Item1.h" 11 | 12 | @implementation HDDemo2Item1 13 | 14 | + (instancetype)item 15 | { 16 | HDDemo2Item1 *item = [super item]; 17 | item.cellClass = [HDDemo2Cell1 class]; 18 | return item; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Item2.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Item2.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDDemo2Item2 : HDTableViewItem 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/View/HDDemo2Item2.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemo2Item2.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/3/9. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemo2Cell2.h" 10 | #import "HDDemo2Item2.h" 11 | 12 | @implementation HDDemo2Item2 13 | 14 | + (instancetype)item 15 | { 16 | HDDemo2Item2 *item = [super item]; 17 | item.cellClass = [HDDemo2Cell2 class]; 18 | return item; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/ViewController/HDDemo2TableViewController.h: -------------------------------------------------------------------------------- 1 | // HDDemo2TableViewController.h 2 | // 3 | // Copyright (c) 2016年 mrdaios 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 13 | // all 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 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface HDDemo2TableViewController : UITableViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Demo2/ViewController/HDDemo2TableViewController.m: -------------------------------------------------------------------------------- 1 | // HDDemo2TableViewController.m 2 | // 3 | // Copyright (c) 2016年 mrdaios 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 13 | // all 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 21 | // THE SOFTWARE. 22 | 23 | #import "HDDemo2Item1.h" 24 | #import "HDDemo2Item2.h" 25 | #import "HDDemo2TableViewController.h" 26 | 27 | @interface HDDemo2TableViewController () 28 | 29 | @property (nonatomic, strong) HDTableViewManager *manager; 30 | @property (nonatomic, strong) HDTableViewSection *section; 31 | 32 | @end 33 | 34 | @implementation HDDemo2TableViewController 35 | 36 | #pragma mark 37 | #pragma mark Init 38 | 39 | #pragma mark 40 | #pragma mark Life Cycle 41 | 42 | - (void)viewDidLoad 43 | { 44 | [super viewDidLoad]; 45 | [self prepareForData]; 46 | [self prepareForView]; 47 | [self prepareForAction]; 48 | 49 | [self.tableView reloadData]; 50 | } 51 | 52 | - (void)viewWillAppear:(BOOL)animated 53 | { 54 | [super viewWillAppear:animated]; 55 | } 56 | 57 | - (void)viewDidAppear:(BOOL)animated 58 | { 59 | [super viewDidAppear:animated]; 60 | } 61 | 62 | - (void)viewDidDisappear:(BOOL)animated 63 | { 64 | [super viewDidDisappear:animated]; 65 | } 66 | 67 | #pragma mark 68 | #pragma mark PrepareConfig 69 | 70 | - (void)prepareForData 71 | { 72 | [self.manager.sections addObject:self.section]; 73 | 74 | HDDemo2Item1 *item1 = [HDDemo2Item1 item]; 75 | [self.section.items addObject:item1]; 76 | 77 | HDDemo2Item2 *item2 = [HDDemo2Item2 item]; 78 | [self.section.items addObject:item2]; 79 | } 80 | 81 | - (void)prepareForView 82 | { 83 | // TableView的配置交给manager,ViewController减少dataSource和delegate 84 | self.tableView.dataSource = self.manager; 85 | self.tableView.delegate = self.manager; 86 | } 87 | 88 | - (void)prepareForAction 89 | { 90 | } 91 | 92 | #pragma mark 93 | #pragma mark XXXDelegate 94 | 95 | #pragma mark 96 | #pragma mark Event Response 97 | 98 | #pragma mark 99 | #pragma mark Getter/Setter 100 | 101 | - (HDTableViewManager *)manager 102 | { 103 | if (nil == _manager) 104 | { 105 | _manager = [HDTableViewManager manager]; 106 | } 107 | return _manager; 108 | } 109 | 110 | - (HDTableViewSection *)section 111 | { 112 | if (nil == _section) 113 | { 114 | _section = [[HDTableViewSection alloc] init]; 115 | } 116 | return _section; 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/Protocol/ButtonPresentable.h: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonPresentable.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ButtonPresentable 12 | 13 | @property (nonatomic, copy) void (^tapAction)(NSString *title); 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/Protocol/ButtonPresentable.m: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonPresentable.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "ButtonPresentable.h" 10 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/Protocol/TitlePresentable.h: -------------------------------------------------------------------------------- 1 | // 2 | // TitlePresentable.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol TitlePresentable 12 | 13 | @property (nonatomic, strong, readwrite) NSString *title; 14 | 15 | @optional 16 | @property (nonatomic, strong, readonly) UIColor *titleColor; 17 | @property (nonatomic, strong, readonly) UIFont *titleFont; 18 | @property (nonatomic, copy, readonly) void (^updateTitleLabel)(UILabel *label); 19 | 20 | @end 21 | 22 | /** 23 | * 默认实现,optional 24 | */ 25 | @interface NSObject (TitlePresentable) 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/Protocol/TitlePresentable.m: -------------------------------------------------------------------------------- 1 | // 2 | // TitlePresentable.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "TitlePresentable.h" 10 | 11 | @implementation NSObject (TitlePresentable) 12 | 13 | //去除警告 14 | @dynamic title; 15 | 16 | - (UIColor *)titleColor 17 | { 18 | return [UIColor redColor]; 19 | } 20 | 21 | - (UIFont *)titleFont 22 | { 23 | return [UIFont systemFontOfSize:14]; 24 | } 25 | 26 | - (void (^)(UILabel *label))updateTitleLabel 27 | { 28 | void (^updateTitleLabel)(UILabel *label) = ^(UILabel *label) { 29 | label.text = self.title; 30 | label.textColor = self.titleColor; 31 | label.font = self.titleFont; 32 | }; 33 | return updateTitleLabel; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/ReadMe: -------------------------------------------------------------------------------- 1 | https://github.com/atConf/atswift-2016-resources/blob/master/keynotes/%E6%9D%8E%E6%B4%81%E4%BF%A1_Pop%20in%20Swift.pdf 2 | oc版变相实现 -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/View/HDDemoTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemoTableViewCell.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol TitlePresentable; 12 | @protocol ButtonPresentable; 13 | 14 | @interface HDDemoTableViewCell : UITableViewCell 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/View/HDDemoTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemoTableViewCell.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "ButtonPresentable.h" 10 | #import "HDDemoTableViewCell.h" 11 | #import "TitlePresentable.h" 12 | 13 | @interface HDDemoTableViewCell () 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *label; 16 | @property (nonatomic, weak) id content; 17 | 18 | @end 19 | 20 | @implementation HDDemoTableViewCell 21 | 22 | 23 | /** 24 | * 配置cell内容 25 | * content推荐用Protcol抽象Cell需要显示的数据,对Model做一次抽象,这样以后就做到了一个Cell对应多个Model。 26 | * 1.Protocol的声明暂时写在Cell的头部. 27 | */ 28 | - (void)hd_setContent:(id)content 29 | { 30 | self.content = content; 31 | if ([self.content conformsToProtocol:@protocol(TitlePresentable)] && 32 | [self.content conformsToProtocol:@protocol(ButtonPresentable)]) 33 | { 34 | [content updateTitleLabel](_label); 35 | } 36 | } 37 | 38 | - (IBAction)tapAction:(id)sender 39 | { 40 | [self.content tapAction]([self.content title]); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/View/HDDemoTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/ViewController/HDDemoTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemoTableViewController.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDDemoTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/ViewController/HDDemoTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemoTableViewController.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemoTableViewCell.h" 10 | #import "HDDemoTableViewCell.h" 11 | #import "HDDemoTableViewController.h" 12 | #import "HDDemoViewModel.h" 13 | 14 | @interface HDDemoTableViewController () 15 | 16 | @property (nonatomic, strong) HDTableViewManager *manager; 17 | 18 | @end 19 | 20 | @implementation HDDemoTableViewController 21 | 22 | - (void)viewDidLoad 23 | { 24 | [super viewDidLoad]; 25 | _manager = [HDTableViewManager manager]; 26 | _manager.cellClass = [HDDemoTableViewCell class]; 27 | HDTableViewSection *section = [HDTableViewSection section]; 28 | 29 | // section.tableViewDidSelectRowAtIndexPath = ^(UITableView *tableView, NSIndexPath 30 | // *indexPath) { 31 | // 32 | // }; 33 | 34 | void (^tapBlock)(NSString *title) = ^(NSString *title) { 35 | NSLog(@"tap Action-%@", title); 36 | }; 37 | 38 | HDDemoViewModel *viewModel = [[HDDemoViewModel alloc] init]; 39 | viewModel.title = @"123"; 40 | viewModel.tapAction = tapBlock; 41 | [section.items addObject:viewModel]; 42 | 43 | viewModel = [[HDDemoViewModel alloc] init]; 44 | viewModel.title = @"456"; 45 | viewModel.tapAction = tapBlock; 46 | [section.items addObject:viewModel]; 47 | 48 | viewModel = [[HDDemoViewModel alloc] init]; 49 | viewModel.title = @"789"; 50 | viewModel.tapAction = tapBlock; 51 | [section.items addObject:viewModel]; 52 | HDTableViewItem *item = [[HDTableViewItem alloc] init]; 53 | [section.items addObject:item]; 54 | 55 | [_manager.sections addObject:section]; 56 | 57 | self.tableView.dataSource = _manager; 58 | self.tableView.delegate = _manager; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/ViewModel/HDDemoViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemoViewModel.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "ButtonPresentable.h" 10 | #import "TitlePresentable.h" 11 | 12 | @interface HDDemoViewModel : NSObject 13 | 14 | @property (nonatomic, strong, readwrite) NSString *title; 15 | @property (nonatomic, copy) void (^tapAction)(NSString *title); 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/DemoModule/ViewModel/HDDemoViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDDemoViewModel.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by Dailingchi on 16/2/23. 6 | // Copyright © 2016年 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDDemoViewModel.h" 10 | 11 | @implementation HDDemoViewModel 12 | 13 | - (UIColor *)titleColor 14 | { 15 | return [UIColor blueColor]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/HDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDAppDelegate.h 3 | // HaidoraTableViewManager 4 | // 5 | // Created by mrdaios on 07/15/2015. 6 | // Copyright (c) 2015 mrdaios. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface HDAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/HDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDAppDelegate.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by mrdaios on 07/15/2015. 6 | // Copyright (c) 2015 mrdaios. All rights reserved. 7 | // 8 | 9 | #import "HDAppDelegate.h" 10 | 11 | @implementation HDAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application 14 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | // Override point for customization after application launch. 17 | return YES; 18 | } 19 | 20 | - (void)applicationWillResignActive:(UIApplication *)application 21 | { 22 | // Sent when the application is about to move from active to inactive state. This can occur for 23 | // certain types of temporary interruptions (such as an incoming phone call or SMS message) or 24 | // 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 26 | // rates. Games should use this method to pause the game. 27 | } 28 | 29 | - (void)applicationDidEnterBackground:(UIApplication *)application 30 | { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store 32 | // enough application state information to restore your application to its current state in case 33 | // it is terminated later. 34 | // If your application supports background execution, this method is called instead of 35 | // applicationWillTerminate: when the user quits. 36 | } 37 | 38 | - (void)applicationWillEnterForeground:(UIApplication *)application 39 | { 40 | // Called as part of the transition from the background to the inactive state; here you can undo 41 | // many of the changes made on entering the background. 42 | } 43 | 44 | - (void)applicationDidBecomeActive:(UIApplication *)application 45 | { 46 | // Restart any tasks that were paused (or not yet started) while the application was inactive. 47 | // If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | - (void)applicationWillTerminate:(UIApplication *)application 51 | { 52 | // Called when the application is about to terminate. Save data if appropriate. See also 53 | // applicationDidEnterBackground:. 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/HaidoraTableViewManager-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | Launch Screen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/HaidoraTableViewManager-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | #import 18 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "736h", 9 | "scale" : "3x" 10 | }, 11 | { 12 | "orientation" : "landscape", 13 | "idiom" : "iphone", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "8.0", 16 | "subtype" : "736h", 17 | "scale" : "3x" 18 | }, 19 | { 20 | "orientation" : "portrait", 21 | "idiom" : "iphone", 22 | "extent" : "full-screen", 23 | "minimum-system-version" : "8.0", 24 | "subtype" : "667h", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "orientation" : "portrait", 29 | "idiom" : "iphone", 30 | "extent" : "full-screen", 31 | "minimum-system-version" : "7.0", 32 | "scale" : "2x" 33 | }, 34 | { 35 | "orientation" : "portrait", 36 | "idiom" : "iphone", 37 | "extent" : "full-screen", 38 | "minimum-system-version" : "7.0", 39 | "subtype" : "retina4", 40 | "scale" : "2x" 41 | }, 42 | { 43 | "orientation" : "portrait", 44 | "idiom" : "ipad", 45 | "extent" : "full-screen", 46 | "minimum-system-version" : "7.0", 47 | "scale" : "1x" 48 | }, 49 | { 50 | "orientation" : "landscape", 51 | "idiom" : "ipad", 52 | "extent" : "full-screen", 53 | "minimum-system-version" : "7.0", 54 | "scale" : "1x" 55 | }, 56 | { 57 | "orientation" : "portrait", 58 | "idiom" : "ipad", 59 | "extent" : "full-screen", 60 | "minimum-system-version" : "7.0", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "orientation" : "landscape", 65 | "idiom" : "ipad", 66 | "extent" : "full-screen", 67 | "minimum-system-version" : "7.0", 68 | "scale" : "2x" 69 | }, 70 | { 71 | "orientation" : "portrait", 72 | "idiom" : "iphone", 73 | "extent" : "full-screen", 74 | "scale" : "1x" 75 | }, 76 | { 77 | "orientation" : "portrait", 78 | "idiom" : "iphone", 79 | "extent" : "full-screen", 80 | "scale" : "2x" 81 | }, 82 | { 83 | "orientation" : "portrait", 84 | "idiom" : "iphone", 85 | "extent" : "full-screen", 86 | "subtype" : "retina4", 87 | "scale" : "2x" 88 | }, 89 | { 90 | "orientation" : "portrait", 91 | "idiom" : "ipad", 92 | "extent" : "to-status-bar", 93 | "scale" : "1x" 94 | }, 95 | { 96 | "orientation" : "portrait", 97 | "idiom" : "ipad", 98 | "extent" : "full-screen", 99 | "scale" : "1x" 100 | }, 101 | { 102 | "orientation" : "landscape", 103 | "idiom" : "ipad", 104 | "extent" : "to-status-bar", 105 | "scale" : "1x" 106 | }, 107 | { 108 | "orientation" : "landscape", 109 | "idiom" : "ipad", 110 | "extent" : "full-screen", 111 | "scale" : "1x" 112 | }, 113 | { 114 | "orientation" : "portrait", 115 | "idiom" : "ipad", 116 | "extent" : "to-status-bar", 117 | "scale" : "2x" 118 | }, 119 | { 120 | "orientation" : "portrait", 121 | "idiom" : "ipad", 122 | "extent" : "full-screen", 123 | "scale" : "2x" 124 | }, 125 | { 126 | "orientation" : "landscape", 127 | "idiom" : "ipad", 128 | "extent" : "to-status-bar", 129 | "scale" : "2x" 130 | }, 131 | { 132 | "orientation" : "landscape", 133 | "idiom" : "ipad", 134 | "extent" : "full-screen", 135 | "scale" : "2x" 136 | } 137 | ], 138 | "info" : { 139 | "version" : 1, 140 | "author" : "xcode" 141 | } 142 | } -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/Launch Screen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/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 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/HaidoraTableViewManager/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HaidoraTableViewManager 4 | // 5 | // Created by mrdaios on 07/15/2015. 6 | // Copyright (c) 2015 mrdaios. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "HDAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([HDAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | target 'HaidoraTableViewManager_Example', :exclusive => true do 4 | pod "HaidoraTableViewManager", :path => "../" 5 | end 6 | 7 | target 'HaidoraTableViewManager_Tests', :exclusive => true do 8 | pod "HaidoraTableViewManager", :path => "../" 9 | 10 | 11 | end 12 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HaidoraTableViewManager (2.0.5) 3 | 4 | DEPENDENCIES: 5 | - HaidoraTableViewManager (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | HaidoraTableViewManager: 9 | :path: ../ 10 | 11 | SPEC CHECKSUMS: 12 | HaidoraTableViewManager: b93c190085ab7a681302df80271d2ad169b0eb19 13 | 14 | COCOAPODS: 0.39.0 15 | -------------------------------------------------------------------------------- /Example/Tests/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 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HaidoraTableViewManagerTests.m 3 | // HaidoraTableViewManagerTests 4 | // 5 | // Created by mrdaios on 07/15/2015. 6 | // Copyright (c) 2015 mrdaios. All rights reserved. 7 | // 8 | 9 | @import XCTest; 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /HaidoraTableViewManager.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "HaidoraTableViewManager" 3 | s.version = "2.0.5" 4 | s.summary = "a wrapper for UITableView." 5 | s.description = <<-DESC 6 | a wrapper for UITableViewDatasource and UITableViewDelegate. 7 | DESC 8 | s.homepage = "https://github.com/Haidora/HaidoraTableViewManager" 9 | s.license = 'MIT' 10 | s.author = { "mrdaios" => "mrdaios@gmail.com" } 11 | s.source = { :git => "https://github.com/Haidora/HaidoraTableViewManager.git", :tag => s.version.to_s } 12 | s.platform = :ios, '7.0' 13 | s.requires_arc = true 14 | s.source_files = 'Pod/Classes/**/*' 15 | #s.resource_bundles = { 16 | # 'HaidoraTableViewManager' => ['Pod/Assets/*.png'] 17 | # } 18 | s.frameworks = 'UIKit', 'Foundation' 19 | end 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 mrdaios 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pod/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Haidora/HaidoraTableViewManager/a7c66af71f070b4e88df90200bb4367db5d65f7f/Pod/Assets/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Haidora/HaidoraTableViewManager/a7c66af71f070b4e88df90200bb4367db5d65f7f/Pod/Classes/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/Cell/UITableViewCell+HDTableViewManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+HDTableViewManager.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import 25 | #import 26 | 27 | /** 28 | UITableViewCell的扩展,方便UITableViewCell的使用 29 | */ 30 | @interface UITableViewCell (HDTableViewManager) 31 | 32 | /** 33 | Cell对应的tableView 34 | */ 35 | @property (nonatomic, weak, readwrite) UITableView *hd_tableView; 36 | 37 | /** 38 | Cell对应的indexPath 39 | */ 40 | @property (nonatomic, strong, readwrite) NSIndexPath *hd_indexPath; 41 | 42 | #pragma mark 43 | #pragma mark Cell Config 44 | 45 | /** 46 | 指定Cell的ReusableIdentifier 47 | 48 | @return 默认返回 NSStringFromClass([self class]) 49 | */ 50 | + (NSString *)hd_ReusableCellIdentifier; 51 | 52 | /** 53 | 配置cell高度 54 | 55 | @return 默认44 56 | */ 57 | + (CGFloat)hd_cellHeight; 58 | 59 | /** 60 | 根据内容配置高度 61 | 62 | @return 默认返回hd_cellHeight 63 | */ 64 | + (CGFloat)hd_cellHeightForTableView:(UITableView *)tableView content:(id)content; 65 | 66 | /** 67 | 用数据配置Cell的UI,可自由发挥 68 | */ 69 | - (void)hd_setContent:(id)content; 70 | 71 | #pragma mark Cell Config nib 72 | 73 | /** 74 | 指定Cell需要加载nib的名称 75 | 76 | @return 默认返回 NSStringFromClass([self class]) 77 | */ 78 | + (NSString *)hd_nibName; 79 | 80 | /** 81 | 创建nib 82 | 83 | @return 默认通过hd_nibName加载 84 | */ 85 | + (UINib *)hd_nib; 86 | 87 | #pragma mark 88 | #pragma mark Load Cell 89 | 90 | #pragma mark Load Cell By code 91 | 92 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 93 | withStyle:(UITableViewCellStyle)style 94 | indexPath:(NSIndexPath *)indexPath; 95 | 96 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 97 | withStyle:(UITableViewCellStyle)style 98 | identifier:(NSString *)identifier 99 | indexPath:(NSIndexPath *)indexPath; 100 | 101 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 102 | withStyle:(UITableViewCellStyle)style 103 | identifier:(NSString *)identifier 104 | indexPath:(NSIndexPath *)indexPath 105 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 106 | NSIndexPath *indexPath))didLoadHandler 107 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 108 | NSIndexPath *indexPath))willAppearHandler; 109 | 110 | #pragma mark Load Cell By nib 111 | 112 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 113 | fromNib:(UINib *)nib 114 | indexPath:(NSIndexPath *)indexPath; 115 | 116 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 117 | fromNib:(UINib *)nib 118 | identifier:(NSString *)identifier 119 | indexPath:(NSIndexPath *)indexPath; 120 | 121 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 122 | fromNib:(UINib *)nib 123 | identifier:(NSString *)identifier 124 | indexPath:(NSIndexPath *)indexPath 125 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 126 | NSIndexPath *indexPath))didLoadHandler 127 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 128 | NSIndexPath *indexPath))willAppearHandler; 129 | 130 | #pragma mark 131 | #pragma mark Life Cycle 132 | 133 | /** 134 | cell创建以后调用 135 | */ 136 | - (void)hd_cellDidLoad __attribute__((objc_requires_super)); 137 | 138 | /** 139 | cell显示时调用(cellForRowAtIndexPath) 140 | */ 141 | - (void)hd_cellWillAppear __attribute__((objc_requires_super)); 142 | 143 | /** 144 | * tableView:willDisplayCell:forRowAtIndexPath: 145 | */ 146 | - (void)hd_cellWillDisplay __attribute__((objc_requires_super)); 147 | 148 | @end 149 | -------------------------------------------------------------------------------- /Pod/Classes/Cell/UITableViewCell+HDTableViewManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+HDTableViewManager.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "UITableViewCell+HDTableViewManager.h" 25 | 26 | #import "UITableViewCell+Deprecated.h" 27 | #import 28 | 29 | static char *kHD_tableView = "kHD_tableView"; 30 | static char *kHD_indexPath = "kHD_indexPath"; 31 | 32 | @implementation UITableViewCell (HDTableViewManager) 33 | 34 | #pragma mark 35 | #pragma mark Cell Config 36 | 37 | + (NSString *)hd_ReusableCellIdentifier 38 | { 39 | #pragma clang diagnostic push 40 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 41 | NSString *hd_ReusableCellIdentifier = [self hd_cellIdentifier]; 42 | #pragma clang diagnostic pop 43 | if (hd_ReusableCellIdentifier.length <= 0) 44 | { 45 | hd_ReusableCellIdentifier = NSStringFromClass([self class]); 46 | } 47 | return hd_ReusableCellIdentifier; 48 | } 49 | 50 | + (CGFloat)hd_cellHeight 51 | { 52 | return 44; 53 | } 54 | 55 | + (CGFloat)hd_cellHeightForTableView:(UITableView *)tableView content:(id)content 56 | { 57 | return [self hd_cellHeight]; 58 | } 59 | 60 | - (void)hd_setContent:(id)content 61 | { 62 | } 63 | 64 | #pragma mark Cell Config nib 65 | 66 | + (NSString *)hd_nibName 67 | { 68 | return NSStringFromClass([self class]); 69 | } 70 | 71 | + (UINib *)hd_nib 72 | { 73 | NSBundle *classBundle = [NSBundle bundleForClass:[self class]]; 74 | if ([classBundle pathForResource:[self hd_nibName] ofType:@"nib"]) 75 | { 76 | return [UINib nibWithNibName:[self hd_nibName] bundle:classBundle]; 77 | } 78 | else 79 | { 80 | return nil; 81 | } 82 | } 83 | 84 | #pragma mark 85 | #pragma mark Load Cell 86 | 87 | #pragma mark Load Cell By code 88 | 89 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 90 | withStyle:(UITableViewCellStyle)style 91 | indexPath:(NSIndexPath *)indexPath 92 | { 93 | NSString *cellIdentifier = @"HABTableViewCellSystem"; 94 | switch (style) 95 | { 96 | case UITableViewCellStyleDefault: 97 | cellIdentifier = @"HABTableViewCellStyleDefault"; 98 | break; 99 | case UITableViewCellStyleValue1: 100 | cellIdentifier = @"HABTableViewCellStyleValue1"; 101 | break; 102 | case UITableViewCellStyleValue2: 103 | cellIdentifier = @"HABTableViewCellStyleValue2"; 104 | break; 105 | case UITableViewCellStyleSubtitle: 106 | cellIdentifier = @"HABTableViewCellStyleSubtitle"; 107 | break; 108 | default: 109 | break; 110 | } 111 | return [self hd_cellForTableView:tableView 112 | withStyle:style 113 | identifier:cellIdentifier 114 | indexPath:indexPath]; 115 | } 116 | 117 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 118 | withStyle:(UITableViewCellStyle)style 119 | identifier:(NSString *)identifier 120 | indexPath:(NSIndexPath *)indexPath 121 | { 122 | return [self hd_cellForTableView:tableView 123 | withStyle:style 124 | identifier:identifier 125 | indexPath:indexPath 126 | didLoadHandler:nil 127 | willAppearHandler:nil]; 128 | } 129 | 130 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 131 | withStyle:(UITableViewCellStyle)style 132 | identifier:(NSString *)identifier 133 | indexPath:(NSIndexPath *)indexPath 134 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 135 | NSIndexPath *indexPath))didLoadHandler 136 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 137 | NSIndexPath *indexPath))willAppearHandler 138 | { 139 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 140 | if (cell == nil) 141 | { 142 | cell = [[[self class] alloc] initWithStyle:style reuseIdentifier:identifier]; 143 | [cell hd_cellDidLoad]; 144 | if (didLoadHandler) 145 | { 146 | didLoadHandler(tableView, cell, indexPath); 147 | } 148 | } 149 | cell.hd_tableView = tableView; 150 | cell.hd_indexPath = indexPath; 151 | [cell hd_cellWillAppear]; 152 | if (willAppearHandler) 153 | { 154 | willAppearHandler(tableView, cell, indexPath); 155 | } 156 | return cell; 157 | } 158 | 159 | #pragma mark Load Cell By nib 160 | 161 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 162 | fromNib:(UINib *)nib 163 | indexPath:(NSIndexPath *)indexPath 164 | { 165 | return [self hd_cellForTableView:tableView 166 | fromNib:nib 167 | identifier:[self hd_ReusableCellIdentifier] 168 | indexPath:indexPath]; 169 | } 170 | 171 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 172 | fromNib:(UINib *)nib 173 | identifier:(NSString *)identifier 174 | indexPath:(NSIndexPath *)indexPath 175 | { 176 | return [self hd_cellForTableView:tableView 177 | fromNib:nib 178 | identifier:identifier 179 | indexPath:indexPath 180 | didLoadHandler:nil 181 | willAppearHandler:nil]; 182 | } 183 | 184 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 185 | fromNib:(UINib *)nib 186 | identifier:(NSString *)identifier 187 | indexPath:(NSIndexPath *)indexPath 188 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 189 | NSIndexPath *indexPath))didLoadHandler 190 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 191 | NSIndexPath *indexPath))willAppearHandler 192 | { 193 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 194 | if (cell == nil) 195 | { 196 | NSArray *nibObjects = [nib instantiateWithOwner:nil options:nil]; 197 | for (UITableViewCell *nibCell in nibObjects) 198 | { 199 | if ([[nibCell class] isSubclassOfClass:[UITableViewCell class]]) 200 | { 201 | if ([nibCell.reuseIdentifier isEqualToString:identifier]) 202 | { 203 | cell = nibCell; 204 | [cell hd_cellDidLoad]; 205 | if (didLoadHandler) 206 | { 207 | didLoadHandler(tableView, cell, indexPath); 208 | } 209 | break; 210 | } 211 | } 212 | } 213 | if (nil == cell) 214 | { 215 | NSAssert(false, @"xib(%@) not set reuseIdentifier for cellClass(%@)", [self hd_nibName], 216 | [nib class]); 217 | } 218 | } 219 | cell.hd_tableView = tableView; 220 | cell.hd_indexPath = indexPath; 221 | [cell hd_cellWillAppear]; 222 | if (willAppearHandler) 223 | { 224 | willAppearHandler(tableView, cell, indexPath); 225 | } 226 | return cell; 227 | } 228 | 229 | #pragma mark 230 | #pragma mark Life cycle 231 | 232 | - (void)hd_cellDidLoad 233 | { 234 | } 235 | 236 | - (void)hd_cellWillAppear 237 | { 238 | } 239 | 240 | - (void)hd_cellWillDisplay 241 | { 242 | } 243 | 244 | #pragma mark 245 | #pragma mark Setter/Getter 246 | 247 | - (void)setHd_tableView:(UITableView *)hd_tableView 248 | { 249 | objc_setAssociatedObject(self, &kHD_tableView, hd_tableView, OBJC_ASSOCIATION_ASSIGN); 250 | } 251 | 252 | - (UITableView *)hd_tableView 253 | { 254 | return objc_getAssociatedObject(self, &kHD_tableView); 255 | } 256 | 257 | - (void)setHd_indexPath:(NSIndexPath *)hd_indexPath 258 | { 259 | objc_setAssociatedObject(self, &kHD_indexPath, hd_indexPath, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 260 | } 261 | 262 | - (NSIndexPath *)hd_indexPath 263 | { 264 | return objc_getAssociatedObject(self, &kHD_indexPath); 265 | } 266 | 267 | @end 268 | -------------------------------------------------------------------------------- /Pod/Classes/Deprecated/HDTableViewItem+Deprecated.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewItem+Deprecated.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewItem.h" 25 | 26 | @interface HDTableViewItem (Deprecated) 27 | 28 | - (void)setItem:(id)item DEPRECATED_ATTRIBUTE; 29 | - (id)item DEPRECATED_ATTRIBUTE; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Pod/Classes/Deprecated/HDTableViewItem+Deprecated.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewItem+Deprecated.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewItem+Deprecated.h" 25 | 26 | @implementation HDTableViewItem (Deprecated) 27 | 28 | - (void)setItem:(id)item 29 | { 30 | self.itemData = item; 31 | } 32 | 33 | - (id)item 34 | { 35 | return self.itemData; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Pod/Classes/Deprecated/HaidoraTableViewManagerDeprecated.h: -------------------------------------------------------------------------------- 1 | // 2 | // HaidoraTableViewManagerDeprecated.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #ifndef HaidoraTableViewManagerDeprecated_h 25 | #define HaidoraTableViewManagerDeprecated_h 26 | 27 | #pragma mark 28 | #pragma mark DEPRECATED 29 | 30 | typedef void (^HDTableViewManagerCellConfigure)(id cell, id itemData, 31 | NSIndexPath *indexPath) DEPRECATED_ATTRIBUTE; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Pod/Classes/Deprecated/UITableViewCell+Deprecated.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+Deprecated.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import 25 | 26 | @interface UITableViewCell (HDTableViewManager_Deprecated) 27 | 28 | @property (nonatomic, weak, readwrite) id hd_item DEPRECATED_ATTRIBUTE; 29 | 30 | /** 31 | * 配置cell复用identifier 32 | * 33 | */ 34 | + (NSString *)hd_cellIdentifier DEPRECATED_ATTRIBUTE; 35 | 36 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 37 | withStyle:(UITableViewCellStyle)style 38 | identifier:(NSString *)identifier 39 | indexPath:(NSIndexPath *)indexPath 40 | item:(id)item DEPRECATED_ATTRIBUTE; 41 | 42 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 43 | withStyle:(UITableViewCellStyle)style 44 | identifier:(NSString *)identifier 45 | indexPath:(NSIndexPath *)indexPath 46 | item:(id)item 47 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 48 | NSIndexPath *indexPath))didLoadHandler 49 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 50 | NSIndexPath *indexPath))willAppearHandler 51 | DEPRECATED_ATTRIBUTE; 52 | 53 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 54 | fromNib:(UINib *)nib 55 | identifier:(NSString *)identifier 56 | indexPath:(NSIndexPath *)indexPath 57 | item:(id)item DEPRECATED_ATTRIBUTE; 58 | 59 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 60 | fromNib:(UINib *)nib 61 | identifier:(NSString *)identifier 62 | indexPath:(NSIndexPath *)indexPath 63 | item:(id)item 64 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 65 | NSIndexPath *indexPath))didLoadHandler 66 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 67 | NSIndexPath *indexPath))willAppearHandler 68 | DEPRECATED_ATTRIBUTE; 69 | 70 | @end -------------------------------------------------------------------------------- /Pod/Classes/Deprecated/UITableViewCell+Deprecated.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+Deprecated.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "UITableViewCell+Deprecated.h" 25 | #import "UITableViewCell+HDTableViewManager.h" 26 | #import 27 | 28 | static char *kHD_item = "kHD_item"; 29 | 30 | @implementation UITableViewCell (HDTableViewManager_Deprecated) 31 | 32 | + (NSString *)hd_cellIdentifier 33 | { 34 | return nil; 35 | } 36 | 37 | - (void)setHd_item:(id)hd_item 38 | { 39 | objc_setAssociatedObject(self, &kHD_item, hd_item, OBJC_ASSOCIATION_ASSIGN); 40 | } 41 | 42 | - (id)hd_item 43 | { 44 | return objc_getAssociatedObject(self, &kHD_item); 45 | } 46 | 47 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 48 | withStyle:(UITableViewCellStyle)style 49 | identifier:(NSString *)identifier 50 | indexPath:(NSIndexPath *)indexPath 51 | item:(id)item 52 | { 53 | return [self hd_cellForTableView:tableView 54 | withStyle:style 55 | identifier:identifier 56 | indexPath:indexPath 57 | item:item 58 | didLoadHandler:nil 59 | willAppearHandler:nil]; 60 | } 61 | 62 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 63 | withStyle:(UITableViewCellStyle)style 64 | identifier:(NSString *)identifier 65 | indexPath:(NSIndexPath *)indexPath 66 | item:(id)item 67 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 68 | NSIndexPath *indexPath))didLoadHandler 69 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 70 | NSIndexPath *indexPath))willAppearHandler 71 | { 72 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 73 | if (cell == nil) 74 | { 75 | cell = [[[self class] alloc] initWithStyle:style reuseIdentifier:identifier]; 76 | [cell hd_cellDidLoad]; 77 | if (didLoadHandler) 78 | { 79 | didLoadHandler(tableView, cell, indexPath); 80 | } 81 | } 82 | cell.hd_tableView = tableView; 83 | cell.hd_indexPath = indexPath; 84 | cell.hd_item = item; 85 | [cell hd_cellWillAppear]; 86 | if (willAppearHandler) 87 | { 88 | willAppearHandler(tableView, cell, indexPath); 89 | } 90 | return cell; 91 | } 92 | 93 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 94 | fromNib:(UINib *)nib 95 | identifier:(NSString *)identifier 96 | indexPath:(NSIndexPath *)indexPath 97 | item:(id)item 98 | { 99 | return [self hd_cellForTableView:tableView 100 | fromNib:nib 101 | identifier:identifier 102 | indexPath:indexPath 103 | item:item 104 | didLoadHandler:nil 105 | willAppearHandler:nil]; 106 | } 107 | 108 | + (instancetype)hd_cellForTableView:(UITableView *)tableView 109 | fromNib:(UINib *)nib 110 | identifier:(NSString *)identifier 111 | indexPath:(NSIndexPath *)indexPath 112 | item:(id)item 113 | didLoadHandler:(void (^)(UITableView *tableView, id cell, 114 | NSIndexPath *indexPath))didLoadHandler 115 | willAppearHandler:(void (^)(UITableView *tableView, id cell, 116 | NSIndexPath *indexPath))willAppearHandler 117 | { 118 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 119 | if (cell == nil) 120 | { 121 | NSArray *nibObjects = [nib instantiateWithOwner:nil options:nil]; 122 | for (UITableViewCell *nibCell in nibObjects) 123 | { 124 | if ([[nibCell class] isSubclassOfClass:[UITableViewCell class]]) 125 | { 126 | if ([nibCell.reuseIdentifier isEqualToString:identifier]) 127 | { 128 | cell = nibCell; 129 | [cell hd_cellDidLoad]; 130 | if (didLoadHandler) 131 | { 132 | didLoadHandler(tableView, cell, indexPath); 133 | } 134 | break; 135 | } 136 | } 137 | } 138 | if (nil == cell) 139 | { 140 | NSAssert(false, @"xib(%@) not set reuseIdentifier for cellClass(%@)", [self hd_nibName], 141 | [nib class]); 142 | } 143 | } 144 | cell.hd_tableView = tableView; 145 | cell.hd_indexPath = indexPath; 146 | cell.hd_item = item; 147 | [cell hd_cellWillAppear]; 148 | if (willAppearHandler) 149 | { 150 | willAppearHandler(tableView, cell, indexPath); 151 | } 152 | return cell; 153 | } 154 | @end 155 | -------------------------------------------------------------------------------- /Pod/Classes/HDTableViewDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewDefines.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #ifndef Pods_HDTableViewDefines_h 25 | #define Pods_HDTableViewDefines_h 26 | 27 | #import 28 | #import 29 | 30 | /** 31 | 如果HDTableViewManagerDelegate中cell高度返回为HDTableViewManagerAutomaticDimension,则根据配置加载UITableViewCell(配置优先级item>section>manager>cell)的高度 32 | 33 | @see -tableView:heightForRowAtIndexPath: 34 | @see -tableView:estimatedHeightForRowAtIndexPath: 35 | */ 36 | extern const CGFloat HDTableViewManagerAutomaticDimension; 37 | 38 | extern const UITableViewCellStyle UITableViewCellStyleUnknow; 39 | extern const CGFloat HDTableViewManagerCellHeightUnknow; 40 | 41 | #pragma mark 42 | #pragma mark HDTableViewConfigureProtocol 43 | 44 | /** 45 | * 用于配置TableView相关属性 46 | */ 47 | @protocol HDTableViewConfigureProtocol 48 | 49 | @optional 50 | /** 51 | TableView的tableView:didSelectRowAtIndexPath:回调 52 | 53 | 配置加载顺序 item>section>manager 54 | 55 | @see tableView:didSelectRowAtIndexPath: 56 | */ 57 | @property (nonatomic, copy, readwrite) void (^tableViewDidSelectRowAtIndexPath) 58 | (UITableView *tableView, NSIndexPath *indexPath); 59 | 60 | /** 61 | TableView的tableView:willDisplayCell:forRowAtIndexPath:回调 62 | 63 | 配置加载顺序 item>section>manager 64 | 65 | @see tableView:willDisplayCell:forRowAtIndexPath:: 66 | */ 67 | @property (nonatomic, copy, readwrite) void (^tableViewWillDisplayCellAtIndexPath) 68 | (UITableView *tableView, UITableViewCell *cell, NSIndexPath *indexPath); 69 | 70 | @end 71 | 72 | #pragma mark 73 | #pragma mark HDTableViewCellConfigureProtocol 74 | /** 75 | * 用于配置TableViewCell相关属性 76 | */ 77 | @protocol HDTableViewCellConfigureProtocol 78 | 79 | @required 80 | 81 | /** 82 | 实例化TableViewCell的Class 83 | 84 | 配置加载顺序 item>section>manager 85 | */ 86 | @property (nonatomic, assign, readwrite) Class cellClass; 87 | 88 | /** 89 | TableViewCell的reusableIdentifier 90 | 91 | 配置加载顺序 item>section>manager>[cell hd_ReusableCellIdentifier] 92 | */ 93 | @property (nonatomic, copy, readwrite) NSString *cellIdentifier; 94 | 95 | /** 96 | TableViewCell的Style,默认是UITableViewCellStyleUnknow 97 | 98 | 配置加载顺序 item>section>manager 99 | 100 | @see UITableViewCellStyle 101 | @warning 通过代码创建Cell时有效 102 | */ 103 | @property (nonatomic, assign, readwrite) UITableViewCellStyle cellStyle; 104 | 105 | /** 106 | TableViewCell的Height,默认是HDTableViewManagerCellHeightUnknow 107 | 108 | 配置加载顺序 item>section>manager>[cell hd_cellHeightForTableView]>[cell hd_cellHeight] 109 | 110 | @see -tableView:heightForRowAtIndexPath: 111 | @see -tableView:estimatedHeightForRowAtIndexPath: 112 | */ 113 | @property (nonatomic, assign, readwrite) CGFloat cellHeight; 114 | 115 | /** 116 | 用于配置TableViewCell的数据 117 | 118 | 配置加载顺序 item>section>manager 119 | 120 | @param cell 对应的cell 121 | @param itemData cell对应的数据 122 | @param indexPath cell对应的indexPath 123 | 124 | @see -tableView:cellForRowAtIndexPath: 125 | */ 126 | @property (nonatomic, copy, readwrite) void (^cellConfigure) 127 | (__kindof UITableViewCell *cell, id itemData, NSIndexPath *indexPath); 128 | 129 | /** 130 | TableViewCell创建后回调 131 | 132 | 配置加载顺序 item>section>manager 133 | 134 | @param tableView cell所在的tableView 135 | @param cell 对应的cell 136 | @param indexPath cell对应的indexPath 137 | 138 | @see -tableView:cellForRowAtIndexPath: 139 | @warning (类似Cell的hd_cellDidLoad,可同时存在) 140 | */ 141 | @property (nonatomic, copy, readwrite) void (^cellDidLoadHandler) 142 | (__kindof UITableView *tableView, __kindof UITableViewCell *cell, NSIndexPath *indexPath); 143 | 144 | /** 145 | TableViewCell创建后回调 146 | 147 | 配置加载顺序 item>section>manager>hd_cellWillDisplay 148 | 149 | @param tableView cell所在的tableView 150 | @param cell 对应的cell 151 | @param indexPath cell对应的indexPath 152 | 153 | @see -tableView:cellForRowAtIndexPath: 154 | @warning (类似Cell的hd_cellWillAppear,可同时存在) 155 | */ 156 | @property (nonatomic, copy, readwrite) void (^cellWillAppearHandler) 157 | (__kindof UITableView *tableView, __kindof UITableViewCell *cell, NSIndexPath *indexPath); 158 | 159 | @end 160 | 161 | #pragma mark 162 | #pragma mark HDTableViewSectionProtocol 163 | /** 164 | * 用于配置TableViewSection相关属性 165 | */ 166 | @protocol HDTableViewSectionProtocol 167 | 168 | @required 169 | #pragma mark Cells 170 | /** 171 | Section下面的cell数据(实现HDTableViewItemProtocol协议的数据或者普通的数据) 172 | */ 173 | @property (nonatomic, strong, readonly) NSMutableArray *items; 174 | 175 | @optional 176 | #pragma mark Header 177 | /** 178 | 指定Section的Header title(如果实现了titleForHeaderInSection则无效) 179 | 180 | @see -tableView:titleForHeaderInSection: 181 | */ 182 | @property (nonatomic, copy, readwrite) NSString *titleForHeader; 183 | 184 | /** 185 | 指定Section的Header的高度(viewForHeader不为空时有效)(如果实现了heightForHeaderInSection则无效) 186 | 187 | @see -tableView:heightForHeaderInSection: 188 | */ 189 | @property (nonatomic, assign, readwrite) CGFloat heightForHeader; 190 | 191 | /** 192 | 指定Section的Header view(如果实现了viewForHeaderInSection则无效) 193 | 194 | @see -tableView:viewForHeaderInSection: 195 | */ 196 | @property (nonatomic, strong, readwrite) UIView *viewForHeader; 197 | 198 | #pragma mark Footer 199 | /** 200 | 指定Section的Footer title如果实现了titleForFooterInSection则无效) 201 | 202 | @see -tableView:titleForFooterInSection: 203 | */ 204 | @property (nonatomic, copy, readwrite) NSString *titleForFooter; 205 | 206 | /** 207 | 指定Section的Footer的高度(viewForFooter不为空时有效)如果实现了heightForFooterInSection则无效) 208 | 209 | @see -tableView:heightForFooterInSection: 210 | */ 211 | @property (nonatomic, assign, readwrite) CGFloat heightForFooter; 212 | 213 | /** 214 | 指定Section的Footer view如果实现了viewForFooterInSection则无效) 215 | 216 | @see -tableView:viewForFooterInSection: 217 | */ 218 | @property (nonatomic, strong, readwrite) UIView *viewForFooter; 219 | 220 | @end 221 | 222 | #pragma mark 223 | #pragma mark HDTableViewItemProtocol 224 | /** 225 | * 用于配置TableViewCell相关属性 226 | */ 227 | @protocol HDTableViewItemProtocol 228 | 229 | @required 230 | /** 231 | cell对应的数据 232 | */ 233 | @property (nonatomic, strong, readwrite) id itemData; 234 | 235 | @optional 236 | @property (nonatomic, strong, readwrite) id item DEPRECATED_ATTRIBUTE; 237 | 238 | @end 239 | 240 | #pragma mark 241 | #pragma mark HDTableViewManagerDelegate 242 | 243 | @protocol HDTableViewManagerDataSource 244 | 245 | @end 246 | 247 | @protocol HDTableViewManagerDelegate 248 | 249 | @end 250 | 251 | #endif 252 | -------------------------------------------------------------------------------- /Pod/Classes/HaidoraTableViewManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // HaidoraTableViewManager.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #ifndef Pods_HaidoraTableViewManager_h 25 | #define Pods_HaidoraTableViewManager_h 26 | 27 | //Manager 28 | #import "HDTableViewManager.h" 29 | #import "HDTableViewManager+UITableViewDataSource.h" 30 | #import "HDTableViewManager+UITableViewDelegate.h" 31 | //Section 32 | #import "HDTableViewSection.h" 33 | //Item 34 | #import "HDTableViewItem.h" 35 | //Cell 36 | #import "UITableViewCell+HDTableViewManager.h" 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Pod/Classes/Item/HDTableViewItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewItem.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewDefines.h" 25 | #import 26 | 27 | /** 28 | Cell的配置 29 | */ 30 | @interface HDTableViewItem : NSObject 32 | 33 | /** 34 | 内部有初始化 35 | */ 36 | + (instancetype)item __attribute__((objc_requires_super)); 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Pod/Classes/Item/HDTableViewItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewItem.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewItem.h" 25 | 26 | @implementation HDTableViewItem 27 | 28 | #pragma mark 29 | #pragma mark HDTableViewConfigureProtocol 30 | 31 | @synthesize tableViewDidSelectRowAtIndexPath = _tableViewDidSelectRowAtIndexPath; 32 | @synthesize tableViewWillDisplayCellAtIndexPath = _tableViewWillDisplayCellAtIndexPath; 33 | 34 | #pragma mark 35 | #pragma mark HDTableViewCellConfigureProtocol 36 | 37 | @synthesize cellClass = _cellClass; 38 | @synthesize cellIdentifier = _cellIdentifier; 39 | @synthesize cellStyle = _cellStyle; 40 | @synthesize cellHeight = _cellHeight; 41 | @synthesize cellConfigure = _cellConfigure; 42 | @synthesize cellDidLoadHandler = _cellDidLoadHandler; 43 | @synthesize cellWillAppearHandler = _cellWillAppearHandler; 44 | 45 | #pragma mark 46 | #pragma mark HDTableViewItemProtocol 47 | 48 | @synthesize itemData = _itemData; 49 | 50 | - (instancetype)init 51 | { 52 | self = [super init]; 53 | if (self) 54 | { 55 | self.cellStyle = UITableViewCellStyleUnknow; 56 | self.cellHeight = HDTableViewManagerCellHeightUnknow; 57 | } 58 | return self; 59 | } 60 | 61 | + (instancetype)item 62 | { 63 | HDTableViewItem *item = [[self alloc] init]; 64 | return item; 65 | } 66 | 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager+HDPrivateUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager+HDPrivateUtils.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HaidoraTableViewManager.h" 25 | /** 26 | * 加载Cell的相关配置(优先级可查看源码) 27 | */ 28 | @interface HDTableViewManager (HDPrivateUtils) 29 | 30 | @property (nonatomic, strong) NSMutableDictionary *nibCache; 31 | 32 | #pragma mark 33 | #pragma mark HDTableViewConfigureProtocol 34 | 35 | - (void (^)(UITableView *tableView, UITableViewCell *cell, NSIndexPath *indexPath)) 36 | loadTableViewWillDisplayCellAtIndexPath:(NSIndexPath *)indexPath; 37 | 38 | - (void (^)(UITableView *tableView, NSIndexPath *indexPath)) 39 | loadTableViewDidSelectRowAtIndexPathWith:(NSIndexPath *)indexPath; 40 | 41 | - (Class)loadClassWith:(NSIndexPath *)indexPath; 42 | 43 | - (NSString *)loadCellIdentifierWith:(NSIndexPath *)indexPath; 44 | 45 | - (UITableViewCellStyle)loadCellStyleWith:(NSIndexPath *)indexPath; 46 | 47 | - (CGFloat)loadCellHeightWith:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath; 48 | 49 | - (void (^)(id cell, id itemData, 50 | NSIndexPath *indexPath))loadCellConfigureWith:(NSIndexPath *)indexPath; 51 | 52 | - (void (^)(UITableView *tableView, id cell, 53 | NSIndexPath *indexPath))loadCellDidLoadHandlerWith:(NSIndexPath *)indexPath; 54 | 55 | - (void (^)(UITableView *tableView, id cell, 56 | NSIndexPath *indexPath))loadCellWillAppearHandlerWith:(NSIndexPath *)indexPath; 57 | 58 | - (UITableViewCell *)loadCellWith:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath; 59 | 60 | - (UINib *)loadNibCacheWith:(Class)cellClass; 61 | 62 | - (id)loadItemDataWith:(NSIndexPath *)indexPath; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager+HDPrivateUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager+HDPrivateUtils.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewManager+HDPrivateUtils.h" 25 | #import 26 | 27 | static char *kHDTableViewSection_HDPrivateUtilsExtend_nibCache = 28 | "kHDTableViewSection_HDPrivateUtilsExtend_nibCache"; 29 | 30 | @implementation HDTableViewManager (HDPrivateUtils) 31 | 32 | - (void (^)(UITableView *tableView, UITableViewCell *cell, 33 | NSIndexPath *indexPath))loadTableViewWillDisplayCellAtIndexPath:(NSIndexPath *)indexPath 34 | { 35 | void (^tableViewWillDisplayCellAtIndexPath)(UITableView *tableView, UITableViewCell *cell, 36 | NSIndexPath *indexPath) = nil; 37 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 38 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewConfigureProtocol)]) 39 | { 40 | tableViewWillDisplayCellAtIndexPath = tableViewItem.tableViewWillDisplayCellAtIndexPath; 41 | } 42 | if (!tableViewWillDisplayCellAtIndexPath) 43 | { 44 | NSObject *tableViewSection = self.sections[indexPath.section]; 45 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewConfigureProtocol)]) 46 | { 47 | tableViewWillDisplayCellAtIndexPath = 48 | tableViewSection.tableViewWillDisplayCellAtIndexPath; 49 | } 50 | } 51 | if (!tableViewWillDisplayCellAtIndexPath) 52 | { 53 | tableViewWillDisplayCellAtIndexPath = self.tableViewWillDisplayCellAtIndexPath; 54 | } 55 | return tableViewWillDisplayCellAtIndexPath; 56 | } 57 | 58 | - (void (^)(UITableView *tableView, NSIndexPath *indexPath)) 59 | loadTableViewDidSelectRowAtIndexPathWith:(NSIndexPath *)indexPath 60 | { 61 | void (^tableViewDidSelectRowAtIndexPathWith)(UITableView *tableView, NSIndexPath *indexPath) = 62 | nil; 63 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 64 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewConfigureProtocol)]) 65 | { 66 | tableViewDidSelectRowAtIndexPathWith = tableViewItem.tableViewDidSelectRowAtIndexPath; 67 | } 68 | if (!tableViewDidSelectRowAtIndexPathWith) 69 | { 70 | NSObject *tableViewSection = self.sections[indexPath.section]; 71 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewConfigureProtocol)]) 72 | { 73 | tableViewDidSelectRowAtIndexPathWith = 74 | tableViewSection.tableViewDidSelectRowAtIndexPath; 75 | } 76 | } 77 | if (!tableViewDidSelectRowAtIndexPathWith) 78 | { 79 | tableViewDidSelectRowAtIndexPathWith = self.tableViewDidSelectRowAtIndexPath; 80 | } 81 | return tableViewDidSelectRowAtIndexPathWith; 82 | } 83 | 84 | - (Class)loadClassWith:(NSIndexPath *)indexPath 85 | { 86 | Class cellClass = nil; 87 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 88 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 89 | { 90 | cellClass = tableViewItem.cellClass; 91 | } 92 | if (!cellClass) 93 | { 94 | NSObject *tableViewSection = 95 | self.sections[indexPath.section]; 96 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 97 | { 98 | cellClass = tableViewSection.cellClass; 99 | } 100 | } 101 | if (!cellClass) 102 | { 103 | cellClass = self.cellClass; 104 | } 105 | if (!cellClass) 106 | { 107 | cellClass = [UITableViewCell class]; 108 | } 109 | return cellClass; 110 | } 111 | 112 | - (NSString *)loadCellIdentifierWith:(NSIndexPath *)indexPath 113 | { 114 | NSString *cellIdentifier; 115 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 116 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 117 | { 118 | cellIdentifier = tableViewItem.cellIdentifier; 119 | } 120 | if (!cellIdentifier) 121 | { 122 | NSObject *tableViewSection = 123 | self.sections[indexPath.section]; 124 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 125 | { 126 | cellIdentifier = tableViewSection.cellIdentifier; 127 | } 128 | } 129 | if (!cellIdentifier) 130 | { 131 | cellIdentifier = self.cellIdentifier; 132 | } 133 | if (!cellIdentifier) 134 | { 135 | cellIdentifier = [[self loadClassWith:indexPath] hd_ReusableCellIdentifier]; 136 | } 137 | return cellIdentifier; 138 | } 139 | 140 | - (UITableViewCellStyle)loadCellStyleWith:(NSIndexPath *)indexPath 141 | { 142 | UITableViewCellStyle cellStyle = UITableViewCellStyleUnknow; 143 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 144 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 145 | { 146 | cellStyle = tableViewItem.cellStyle; 147 | } 148 | if (cellStyle == UITableViewCellStyleUnknow) 149 | { 150 | NSObject *tableViewSection = 151 | self.sections[indexPath.section]; 152 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 153 | { 154 | cellStyle = tableViewSection.cellStyle; 155 | } 156 | } 157 | if (cellStyle == UITableViewCellStyleUnknow) 158 | { 159 | cellStyle = self.cellStyle; 160 | } 161 | if (cellStyle == UITableViewCellStyleUnknow) 162 | { 163 | cellStyle = UITableViewCellStyleDefault; 164 | } 165 | return cellStyle; 166 | } 167 | 168 | - (CGFloat)loadCellHeightWith:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath 169 | { 170 | CGFloat height = HDTableViewManagerCellHeightUnknow; 171 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 172 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 173 | { 174 | height = tableViewItem.cellHeight; 175 | } 176 | if (height == HDTableViewManagerCellHeightUnknow) 177 | { 178 | NSObject *tableViewSection = 179 | self.sections[indexPath.section]; 180 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 181 | { 182 | height = tableViewSection.cellHeight; 183 | } 184 | } 185 | if (height == HDTableViewManagerCellHeightUnknow) 186 | { 187 | height = self.cellHeight; 188 | } 189 | if (height == HDTableViewManagerCellHeightUnknow) 190 | { 191 | Class cellClass = [self loadClassWith:indexPath]; 192 | if ([cellClass isSubclassOfClass:[UITableViewCell class]]) 193 | { 194 | height = [cellClass hd_cellHeightForTableView:tableView 195 | content:[self loadItemDataWith:indexPath]]; 196 | } 197 | } 198 | return height; 199 | } 200 | 201 | - (void (^)(id cell, id itemData, 202 | NSIndexPath *indexPath))loadCellConfigureWith:(NSIndexPath *)indexPath 203 | { 204 | void (^cellConfigure)(id cell, id itemData, NSIndexPath *indexPath) = nil; 205 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 206 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 207 | { 208 | cellConfigure = tableViewItem.cellConfigure; 209 | } 210 | if (!cellConfigure) 211 | { 212 | NSObject *tableViewSection = 213 | self.sections[indexPath.section]; 214 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 215 | { 216 | cellConfigure = tableViewSection.cellConfigure; 217 | } 218 | } 219 | if (!cellConfigure) 220 | { 221 | cellConfigure = self.cellConfigure; 222 | } 223 | return cellConfigure; 224 | } 225 | 226 | - (void (^)(UITableView *tableView, id cell, 227 | NSIndexPath *indexPath))loadCellDidLoadHandlerWith:(NSIndexPath *)indexPath 228 | { 229 | void (^cellDidLoadHandler)(UITableView *tableView, id cell, NSIndexPath *indexPath) = nil; 230 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 231 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 232 | { 233 | cellDidLoadHandler = tableViewItem.cellDidLoadHandler; 234 | } 235 | if (!cellDidLoadHandler) 236 | { 237 | NSObject *tableViewSection = 238 | self.sections[indexPath.section]; 239 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 240 | { 241 | cellDidLoadHandler = tableViewSection.cellDidLoadHandler; 242 | } 243 | } 244 | if (!cellDidLoadHandler) 245 | { 246 | cellDidLoadHandler = self.cellDidLoadHandler; 247 | } 248 | return cellDidLoadHandler; 249 | } 250 | 251 | - (void (^)(UITableView *tableView, id cell, 252 | NSIndexPath *indexPath))loadCellWillAppearHandlerWith:(NSIndexPath *)indexPath 253 | { 254 | void (^cellWillAppearHandler)(UITableView *tableView, id cell, NSIndexPath *indexPath) = nil; 255 | NSObject *tableViewItem = [self itemAtIndexPath:indexPath]; 256 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 257 | { 258 | cellWillAppearHandler = tableViewItem.cellWillAppearHandler; 259 | } 260 | if (!cellWillAppearHandler) 261 | { 262 | NSObject *tableViewSection = 263 | self.sections[indexPath.section]; 264 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewCellConfigureProtocol)]) 265 | { 266 | cellWillAppearHandler = tableViewSection.cellWillAppearHandler; 267 | } 268 | } 269 | if (!cellWillAppearHandler) 270 | { 271 | cellWillAppearHandler = self.cellWillAppearHandler; 272 | } 273 | return cellWillAppearHandler; 274 | } 275 | 276 | - (UITableViewCell *)loadCellWith:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath 277 | { 278 | UITableViewCell *cell; 279 | Class cellClass = [self loadClassWith:indexPath]; 280 | NSString *cellellIdentifier = [self loadCellIdentifierWith:indexPath]; 281 | UINib *nib = [self loadNibCacheWith:cellClass]; 282 | void (^cellDidLoadHandler)(UITableView *tableView, id cell, NSIndexPath *indexPath) = 283 | [self loadCellDidLoadHandlerWith:indexPath]; 284 | void (^cellWillAppearHandler)(UITableView *tableView, id cell, NSIndexPath *indexPath) = 285 | [self loadCellWillAppearHandlerWith:indexPath]; 286 | if (nib) 287 | { 288 | cell = [cellClass hd_cellForTableView:tableView 289 | fromNib:nib 290 | identifier:cellellIdentifier 291 | indexPath:indexPath 292 | didLoadHandler:cellDidLoadHandler 293 | willAppearHandler:cellWillAppearHandler]; 294 | } 295 | else 296 | { 297 | UITableViewCellStyle cellStyle = [self loadCellStyleWith:indexPath]; 298 | if (cellellIdentifier.length > 0) 299 | { 300 | cell = [cellClass hd_cellForTableView:tableView 301 | withStyle:cellStyle 302 | identifier:cellellIdentifier 303 | indexPath:indexPath 304 | didLoadHandler:cellDidLoadHandler 305 | willAppearHandler:cellWillAppearHandler]; 306 | } 307 | else 308 | { 309 | // need call 310 | cell = 311 | [cellClass hd_cellForTableView:tableView withStyle:cellStyle indexPath:indexPath]; 312 | } 313 | } 314 | return cell; 315 | } 316 | 317 | - (UINib *)loadNibCacheWith:(Class)cellClass 318 | { 319 | NSAssert([cellClass isSubclassOfClass:[UITableViewCell class]], 320 | @"cellClass need subClass of UITablViewCell"); 321 | UINib *nib = self.nibCache[NSStringFromClass(cellClass)]; 322 | if (!nib) 323 | { 324 | nib = [cellClass hd_nib]; 325 | if (nib) 326 | { 327 | self.nibCache[NSStringFromClass(cellClass)] = nib; 328 | } 329 | } 330 | return nib; 331 | } 332 | 333 | - (id)loadItemDataWith:(NSIndexPath *)indexPath 334 | { 335 | id item = nil; 336 | NSObject *tableViewSection = self.sections[indexPath.section]; 337 | NSMutableArray *rows = [tableViewSection items]; 338 | NSObject *tableViewItem = rows[indexPath.row]; 339 | if ([tableViewItem conformsToProtocol:@protocol(HDTableViewItemProtocol)]) 340 | { 341 | item = tableViewItem.itemData; 342 | } 343 | else 344 | { 345 | item = tableViewItem; 346 | } 347 | return item; 348 | } 349 | 350 | #pragma mark 351 | #pragma mark Getter/Setter 352 | 353 | - (void)setNibCache:(NSMutableDictionary *)nibCache 354 | { 355 | objc_setAssociatedObject(self, &kHDTableViewSection_HDPrivateUtilsExtend_nibCache, nibCache, 356 | OBJC_ASSOCIATION_RETAIN_NONATOMIC); 357 | } 358 | 359 | - (NSMutableDictionary *)nibCache 360 | { 361 | NSMutableDictionary *nibCache = 362 | objc_getAssociatedObject(self, &kHDTableViewSection_HDPrivateUtilsExtend_nibCache); 363 | if (nil == nibCache) 364 | { 365 | nibCache = [NSMutableDictionary dictionary]; 366 | [self setNibCache:nibCache]; 367 | } 368 | return nibCache; 369 | } 370 | 371 | @end 372 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager+UITableViewDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager+UITableViewDataSource.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import 25 | #import 26 | 27 | #import "HDTableViewManager.h" 28 | 29 | @interface HDTableViewManager (UITableViewDataSource) 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager+UITableViewDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager+UITableViewDataSource.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewManager+UITableViewDataSource.h" 25 | 26 | #import "HDTableViewManager+HDPrivateUtils.h" 27 | 28 | @implementation HDTableViewManager (UITableViewDataSource) 29 | 30 | #pragma mark 31 | #pragma mark UITableViewDataSource 32 | 33 | #pragma mark UITableViewDataSource required 34 | 35 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 36 | { 37 | NSInteger numberOfRows = 0; 38 | NSObject *tableViewSection = self.sections[section]; 39 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewSectionProtocol)]) 40 | { 41 | numberOfRows = [tableViewSection items].count; 42 | } 43 | else 44 | { 45 | NSAssert(NO, @"%@ need conforms to HDTableViewSectionProtocol", [tableViewSection class]); 46 | } 47 | return numberOfRows; 48 | } 49 | 50 | - (UITableViewCell *)tableView:(UITableView *)tableView 51 | cellForRowAtIndexPath:(NSIndexPath *)indexPath 52 | { 53 | UITableViewCell *cell = nil; 54 | // if have datasource then load datasource value 55 | if ([self.dataSource respondsToSelector:@selector(tableView:cellForRowAtIndexPath:)]) 56 | { 57 | cell = [self.dataSource tableView:tableView cellForRowAtIndexPath:indexPath]; 58 | } 59 | // check cell is load;(when datasource is uitableviewcontroller) 60 | if (!cell) 61 | { 62 | cell = [self loadCellWith:tableView indexPath:indexPath]; 63 | } 64 | // config cell 65 | void (^cellConfigure)(id cell, id itemData, NSIndexPath *indexPath) = 66 | [self loadCellConfigureWith:indexPath]; 67 | if (cellConfigure) 68 | { 69 | cellConfigure(cell, [self loadItemDataWith:indexPath], indexPath); 70 | } 71 | return cell; 72 | } 73 | 74 | #pragma mark 75 | #pragma mark UITableViewDataSource optional 76 | 77 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 78 | { 79 | NSInteger item = self.sections.count; 80 | return item; 81 | } 82 | 83 | #pragma mark 84 | #pragma mark UITableViewDataSource optional Section Title 85 | 86 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 87 | { 88 | NSString *title = @""; 89 | if ([self.dataSource respondsToSelector:@selector(tableView:titleForHeaderInSection:)]) 90 | { 91 | title = [self.dataSource tableView:tableView titleForHeaderInSection:section]; 92 | } 93 | else 94 | { 95 | NSObject *tableViewSection = self.sections[section]; 96 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewSectionProtocol)]) 97 | { 98 | title = [tableViewSection titleForHeader]; 99 | } 100 | } 101 | return title; 102 | } 103 | 104 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 105 | { 106 | NSString *title = @""; 107 | if ([self.dataSource respondsToSelector:@selector(tableView:titleForFooterInSection:)]) 108 | { 109 | title = [self.dataSource tableView:tableView titleForFooterInSection:section]; 110 | } 111 | else 112 | { 113 | NSObject *tableViewSection = self.sections[section]; 114 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewSectionProtocol)]) 115 | { 116 | title = [tableViewSection titleForFooter]; 117 | } 118 | } 119 | return title; 120 | } 121 | 122 | #pragma mark 123 | #pragma mark UITableViewDataSource optional Delete Action 124 | 125 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 126 | { 127 | BOOL canEdit = NO; 128 | if ([self.dataSource respondsToSelector:@selector(tableView:canEditRowAtIndexPath:)]) 129 | { 130 | canEdit = [self.dataSource tableView:tableView canEditRowAtIndexPath:indexPath]; 131 | } 132 | return canEdit; 133 | } 134 | 135 | @end 136 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager+UITableViewDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager+UITableViewDelegate.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import 25 | #import 26 | 27 | #import "HDTableViewManager.h" 28 | 29 | @interface HDTableViewManager (UITableViewDelegate) 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager+UITableViewDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager+UITableViewDelegate.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewManager+UITableViewDelegate.h" 25 | 26 | #import "HDTableViewManager+HDPrivateUtils.h" 27 | 28 | @implementation HDTableViewManager (UITableViewDelegate) 29 | 30 | #pragma mark 31 | #pragma mark UITableViewDelegate 32 | #pragma mark 33 | #pragma mark UITableViewDelegate optional row height 34 | 35 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 36 | { 37 | CGFloat height = HDTableViewManagerAutomaticDimension; 38 | if ([self.delegate respondsToSelector:@selector(tableView:heightForRowAtIndexPath:)]) 39 | { 40 | height = [self.delegate tableView:tableView heightForRowAtIndexPath:indexPath]; 41 | } 42 | if (height == HDTableViewManagerAutomaticDimension) 43 | { 44 | height = [self loadCellHeightWith:tableView indexPath:indexPath]; 45 | } 46 | return height; 47 | } 48 | 49 | - (CGFloat)tableView:(UITableView *)tableView 50 | estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath 51 | { 52 | CGFloat height = HDTableViewManagerAutomaticDimension; 53 | if ([self.delegate respondsToSelector:@selector(tableView:estimatedHeightForRowAtIndexPath:)]) 54 | { 55 | height = [self.delegate tableView:tableView estimatedHeightForRowAtIndexPath:indexPath]; 56 | } 57 | if (height == HDTableViewManagerAutomaticDimension) 58 | { 59 | height = [self loadCellHeightWith:tableView indexPath:indexPath]; 60 | } 61 | return height; 62 | } 63 | 64 | #pragma mark 65 | #pragma mark UITableViewDelegate optional Section height 66 | 67 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 68 | { 69 | CGFloat height = UITableViewAutomaticDimension; 70 | if ([self.delegate respondsToSelector:@selector(tableView:heightForHeaderInSection:)]) 71 | { 72 | height = [self.delegate tableView:tableView heightForHeaderInSection:section]; 73 | } 74 | else 75 | { 76 | NSObject *tableViewSection = self.sections[section]; 77 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewSectionProtocol)]) 78 | { 79 | if ([tableViewSection viewForHeader]) 80 | { 81 | height = [tableViewSection heightForHeader]; 82 | } 83 | } 84 | } 85 | return height; 86 | } 87 | 88 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 89 | { 90 | CGFloat height = UITableViewAutomaticDimension; 91 | if ([self.delegate respondsToSelector:@selector(tableView:heightForFooterInSection:)]) 92 | { 93 | height = [self.delegate tableView:tableView heightForFooterInSection:section]; 94 | } 95 | else 96 | { 97 | NSObject *tableViewSection = self.sections[section]; 98 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewSectionProtocol)]) 99 | { 100 | if ([tableViewSection viewForFooter]) 101 | { 102 | height = [tableViewSection heightForFooter]; 103 | } 104 | } 105 | } 106 | return height; 107 | } 108 | 109 | #pragma mark 110 | #pragma mark UITableViewDelegate optional Section View 111 | 112 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 113 | { 114 | UIView *view = nil; 115 | if ([self.delegate respondsToSelector:@selector(tableView:viewForHeaderInSection:)]) 116 | { 117 | view = [self.delegate tableView:tableView viewForHeaderInSection:section]; 118 | } 119 | else 120 | { 121 | NSObject *tableViewSection = self.sections[section]; 122 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewSectionProtocol)]) 123 | { 124 | view = [tableViewSection viewForHeader]; 125 | } 126 | } 127 | return view; 128 | } 129 | 130 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 131 | { 132 | UIView *view = nil; 133 | if ([self.delegate respondsToSelector:@selector(tableView:viewForFooterInSection:)]) 134 | { 135 | view = [self.delegate tableView:tableView viewForFooterInSection:section]; 136 | } 137 | else 138 | { 139 | NSObject *tableViewSection = self.sections[section]; 140 | if ([tableViewSection conformsToProtocol:@protocol(HDTableViewSectionProtocol)]) 141 | { 142 | view = [tableViewSection viewForFooter]; 143 | } 144 | } 145 | return view; 146 | } 147 | 148 | #pragma mark 149 | #pragma mark optional Delete Action 150 | 151 | - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView 152 | editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 153 | { 154 | UITableViewCellEditingStyle editingStyle = UITableViewCellEditingStyleNone; 155 | if ([self.delegate respondsToSelector:@selector(tableView:editingStyleForRowAtIndexPath:)]) 156 | { 157 | editingStyle = [self.delegate tableView:tableView editingStyleForRowAtIndexPath:indexPath]; 158 | } 159 | return editingStyle; 160 | } 161 | 162 | - (NSString *)tableView:(UITableView *)tableView 163 | titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath 164 | { 165 | NSString *titleForDelete = NSLocalizedString(@"Delete", @""); 166 | if ([self.delegate respondsToSelector:@selector(tableView: 167 | titleForDeleteConfirmationButtonForRowAtIndexPath:)]) 168 | { 169 | [self.delegate tableView:tableView 170 | titleForDeleteConfirmationButtonForRowAtIndexPath:indexPath]; 171 | } 172 | return titleForDelete; 173 | } 174 | 175 | - (void)tableView:(UITableView *)tableView 176 | commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 177 | forRowAtIndexPath:(NSIndexPath *)indexPath 178 | { 179 | if ([self.dataSource 180 | respondsToSelector:@selector(tableView:commitEditingStyle:forRowAtIndexPath:)]) 181 | { 182 | [self.dataSource tableView:tableView 183 | commitEditingStyle:editingStyle 184 | forRowAtIndexPath:indexPath]; 185 | } 186 | else 187 | { 188 | [tableView beginUpdates]; 189 | if (editingStyle == UITableViewCellEditingStyleDelete) 190 | { 191 | NSObject *tableViewSection = 192 | self.sections[indexPath.section]; 193 | NSMutableArray *rows = [tableViewSection items]; 194 | [rows removeObjectAtIndex:indexPath.row]; 195 | [tableView deleteRowsAtIndexPaths:@[ indexPath ] 196 | withRowAnimation:UITableViewRowAnimationAutomatic]; 197 | } 198 | [tableView endUpdates]; 199 | } 200 | } 201 | 202 | #pragma mark 203 | #pragma mark UITableViewDelegate optional Action 204 | 205 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 206 | { 207 | if ([self.delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]) 208 | { 209 | [self.delegate tableView:tableView didSelectRowAtIndexPath:indexPath]; 210 | } 211 | else 212 | { 213 | void (^tableViewDidSelectRowAtIndexPathWith)(UITableView *tableView, 214 | NSIndexPath *indexPath) = 215 | [self loadTableViewDidSelectRowAtIndexPathWith:indexPath]; 216 | if (tableViewDidSelectRowAtIndexPathWith) 217 | { 218 | tableViewDidSelectRowAtIndexPathWith(tableView, indexPath); 219 | } 220 | else 221 | { 222 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 223 | } 224 | } 225 | } 226 | 227 | #pragma mark 228 | #pragma mark UITableViewDelegate optional Display customization 229 | 230 | - (void)tableView:(UITableView *)tableView 231 | willDisplayCell:(UITableViewCell *)cell 232 | forRowAtIndexPath:(NSIndexPath *)indexPath 233 | { 234 | if ([self.delegate respondsToSelector:@selector(tableView:willDisplayCell:forRowAtIndexPath:)]) 235 | { 236 | [self.delegate tableView:tableView willDisplayCell:cell forRowAtIndexPath:indexPath]; 237 | } 238 | else 239 | { 240 | void (^tableViewWillDisplayCellAtIndexPath)(UITableView *tableView, UITableViewCell *cell, 241 | NSIndexPath *indexPath) = 242 | [self loadTableViewWillDisplayCellAtIndexPath:indexPath]; 243 | if (tableViewWillDisplayCellAtIndexPath) 244 | { 245 | tableViewWillDisplayCellAtIndexPath(tableView, cell, indexPath); 246 | } 247 | else 248 | { 249 | [cell hd_cellWillDisplay]; 250 | } 251 | } 252 | } 253 | 254 | @end 255 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import 25 | #import 26 | 27 | #import "HDTableViewDefines.h" 28 | 29 | /** 30 | UITableVieDataSource 和 UITableViewDelegate的封装. 31 | */ 32 | @interface HDTableViewManager 33 | : NSObject 34 | 35 | /** 36 | * 对应UITableView中的sections.(元素需要实现),auto create 39 | */ 40 | @property (nonatomic, strong, readwrite) NSMutableArray *sections; 41 | 42 | /** 43 | * ,默认为nil 44 | */ 45 | @property (nonatomic, weak, readwrite) id dataSource; 46 | 47 | /** 48 | * ,默认为nil 49 | */ 50 | @property (nonatomic, weak, readwrite) id delegate; 51 | 52 | - (instancetype)initWithSections:(NSMutableArray *)sections 53 | cellClass:(Class)cellClass 54 | cellStyle:(UITableViewCellStyle)cellStyle 55 | configureCellBlock:(void (^)(id cell, id itemData, 56 | NSIndexPath *indexPath))cellConfigure 57 | delegate:(id)delegate; 58 | 59 | /** 60 | * 创建manager 61 | * 62 | * @param sections 63 | * @param cellClass 默认为UITableViewCell 64 | * @param cellStyle 默认为UITableViewCellStyleDefault 65 | * @param cellConfigure 默认为[tableViewCell hd_setContent:xxx] 66 | * @param delegate 默认为nil 67 | * 68 | * @return 69 | */ 70 | + (instancetype)manager; 71 | 72 | @end 73 | 74 | @interface HDTableViewManager (HDTableViewManager_Utils) 75 | 76 | /** 77 | * 获取指定indexPath的item 78 | */ 79 | - (id)itemAtIndexPath:(NSIndexPath *)indexPath; 80 | 81 | /** 82 | * 获取指定indexPath的数据模型 83 | * 84 | */ 85 | - (id)itemDataAtIndexPath:(NSIndexPath *)indexPath; 86 | 87 | /** 88 | * 计算Cell高度,如果计算高度不对,请配合使用https://github.com/forkingdog/UITableView-FDTemplateLayoutCell 89 | */ 90 | - (CGFloat)hd_tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Pod/Classes/Manager/HDTableViewManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewManager.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewManager+HDPrivateUtils.h" 25 | #import "HDTableViewManager+UITableViewDataSource.h" 26 | #import "HDTableViewManager.h" 27 | #import "UITableViewCell+HDTableViewManager.h" 28 | 29 | const CGFloat HDTableViewManagerAutomaticDimension = -7; 30 | const UITableViewCellStyle UITableViewCellStyleUnknow = -7; 31 | const CGFloat HDTableViewManagerCellHeightUnknow = NSIntegerMax; 32 | 33 | @interface HDTableViewManager () 34 | @end 35 | 36 | @implementation HDTableViewManager 37 | 38 | #pragma mark 39 | #pragma mark HDTableViewConfigureProtocol 40 | 41 | @synthesize tableViewDidSelectRowAtIndexPath = _tableViewDidSelectRowAtIndexPath; 42 | @synthesize tableViewWillDisplayCellAtIndexPath = _tableViewWillDisplayCellAtIndexPath; 43 | 44 | #pragma mark 45 | #pragma mark HDTableViewCellConfigureProtocol 46 | 47 | @synthesize cellClass = _cellClass; 48 | @synthesize cellIdentifier = _cellIdentifier; 49 | @synthesize cellStyle = _cellStyle; 50 | @synthesize cellHeight = _cellHeight; 51 | @synthesize cellConfigure = _cellConfigure; 52 | @synthesize cellDidLoadHandler = _cellDidLoadHandler; 53 | @synthesize cellWillAppearHandler = _cellWillAppearHandler; 54 | 55 | #pragma mark 56 | #pragma mark Init 57 | 58 | - (instancetype)init 59 | { 60 | self = [super init]; 61 | if (self) 62 | { 63 | self.cellHeight = HDTableViewManagerCellHeightUnknow; 64 | self.cellStyle = UITableViewCellStyleUnknow; 65 | } 66 | return self; 67 | } 68 | 69 | - (instancetype)initWithSections:(NSMutableArray *)sections 70 | cellClass:(Class)cellClass 71 | cellStyle:(UITableViewCellStyle)cellStyle 72 | configureCellBlock:(void (^)(id cell, id itemData, 73 | NSIndexPath *indexPath))cellConfigure 74 | delegate:(id)delegate 75 | { 76 | self = [self init]; 77 | if (self) 78 | { 79 | self.sections = sections; 80 | self.cellClass = cellClass; 81 | self.cellStyle = cellStyle; 82 | self.cellConfigure = [cellConfigure copy]; 83 | self.delegate = delegate; 84 | } 85 | return self; 86 | } 87 | 88 | + (instancetype)manager 89 | { 90 | HDTableViewManager *manager = 91 | [[HDTableViewManager alloc] initWithSections:[NSMutableArray array] 92 | cellClass:[UITableViewCell class] 93 | cellStyle:UITableViewCellStyleDefault 94 | configureCellBlock:^(id cell, id item, NSIndexPath *indexPath) { 95 | UITableViewCell *mCell = cell; 96 | [mCell hd_setContent:item]; 97 | } 98 | delegate:nil]; 99 | return manager; 100 | } 101 | 102 | #pragma mark 103 | #pragma mark Forwarding to DataSource / Delegate 104 | //@link http://blog.scottlogic.com/2012/11/19/a-multicast-delegate-pattern-for-ios-controls.html 105 | 106 | - (BOOL)respondsToSelector:(SEL)aSelector 107 | { 108 | if ([super respondsToSelector:aSelector]) 109 | { 110 | return YES; 111 | } 112 | else if (((id)self != (id)self.dataSource) && [self.dataSource respondsToSelector:aSelector]) 113 | { 114 | return YES; 115 | } 116 | else if (((id)self != (id)self.delegate) && [self.delegate respondsToSelector:aSelector]) 117 | { 118 | return YES; 119 | } 120 | else 121 | { 122 | return NO; 123 | } 124 | } 125 | 126 | - (id)forwardingTargetForSelector:(SEL)aSelector 127 | { 128 | if (((id)self != (id)self.dataSource) && [self.dataSource respondsToSelector:aSelector]) 129 | { 130 | return self.dataSource; 131 | } 132 | else if (((id)self != (id)self.delegate) && [self.delegate respondsToSelector:aSelector]) 133 | { 134 | return self.delegate; 135 | } 136 | else 137 | { 138 | // never call 139 | return nil; 140 | } 141 | } 142 | 143 | - (void)doesNotRecognizeSelector:(SEL)aSelector 144 | { 145 | // never call 146 | NSLog(@"%@_doesNotRecognizeSelector:%@", NSStringFromClass([self class]), 147 | NSStringFromSelector(aSelector)); 148 | } 149 | 150 | #pragma mark 151 | #pragma mark Getter 152 | 153 | - (NSMutableArray *)sections 154 | { 155 | if (nil == _sections) 156 | { 157 | _sections = [[NSMutableArray alloc] init]; 158 | } 159 | return _sections; 160 | } 161 | 162 | @end 163 | 164 | @implementation HDTableViewManager (HDTableViewManager_Utils) 165 | 166 | #pragma mark 167 | #pragma mark public method 168 | 169 | - (id)itemAtIndexPath:(NSIndexPath *)indexPath 170 | { 171 | NSObject *tableViewSection = _sections[indexPath.section]; 172 | NSMutableArray *rows = tableViewSection.items; 173 | return rows[indexPath.row]; 174 | } 175 | 176 | - (id)itemDataAtIndexPath:(NSIndexPath *)indexPath 177 | { 178 | return [self loadItemDataWith:indexPath]; 179 | } 180 | 181 | - (CGFloat)hd_tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 182 | { 183 | CGFloat height = 0; 184 | 185 | UITableViewCell *cell = [self loadCellWith:tableView indexPath:indexPath]; 186 | void (^cellConfigure)(id cell, id itemData, NSIndexPath *indexPath) = 187 | [self loadCellConfigureWith:indexPath]; 188 | if (cellConfigure) 189 | { 190 | cellConfigure(cell, [self loadItemDataWith:indexPath], indexPath); 191 | } 192 | [cell layoutIfNeeded]; 193 | CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 194 | // fix contenView height +1 195 | // for uilabel you need set preferredMaxLayoutWidth 196 | height = size.height + 1; 197 | return height; 198 | } 199 | @end 200 | -------------------------------------------------------------------------------- /Pod/Classes/Section/HDTableViewSection.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewSection.h 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import 25 | 26 | #import "HDTableViewDefines.h" 27 | 28 | /** 29 | Section的配置 30 | */ 31 | @interface HDTableViewSection 32 | : NSObject 34 | 35 | /** 36 | 内部有初始化,self.items懒加载 37 | */ 38 | + (instancetype)section __attribute__((objc_requires_super)); 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pod/Classes/Section/HDTableViewSection.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewSection.m 3 | // 4 | // Copyright (c) 2016年 mrdaios 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import "HDTableViewSection.h" 25 | 26 | @implementation HDTableViewSection 27 | 28 | #pragma mark 29 | #pragma mark HDTableViewConfigureProtocol 30 | 31 | @synthesize tableViewDidSelectRowAtIndexPath = _tableViewDidSelectRowAtIndexPath; 32 | @synthesize tableViewWillDisplayCellAtIndexPath = _tableViewWillDisplayCellAtIndexPath; 33 | 34 | #pragma mark 35 | #pragma mark HDTableViewCellConfigureProtocol 36 | 37 | @synthesize cellClass = _cellClass; 38 | @synthesize cellIdentifier = _cellIdentifier; 39 | @synthesize cellStyle = _cellStyle; 40 | @synthesize cellHeight = _cellHeight; 41 | @synthesize cellConfigure = _cellConfigure; 42 | @synthesize cellDidLoadHandler = _cellDidLoadHandler; 43 | @synthesize cellWillAppearHandler = _cellWillAppearHandler; 44 | 45 | #pragma mark 46 | #pragma mark HDTableViewSectionProtocol 47 | 48 | @synthesize titleForHeader = _titleForHeader; 49 | @synthesize heightForHeader = _heightForHeader; 50 | @synthesize viewForHeader = _viewForHeader; 51 | @synthesize titleForFooter = _titleForFooter; 52 | @synthesize heightForFooter = _heightForFooter; 53 | @synthesize viewForFooter = _viewForFooter; 54 | 55 | @synthesize items = _items; 56 | 57 | - (instancetype)init 58 | { 59 | self = [super init]; 60 | if (self) 61 | { 62 | self.cellStyle = UITableViewCellStyleUnknow; 63 | self.cellHeight = HDTableViewManagerCellHeightUnknow; 64 | } 65 | return self; 66 | } 67 | 68 | + (instancetype)section 69 | { 70 | HDTableViewSection *section = [[self alloc] init]; 71 | return section; 72 | } 73 | 74 | #pragma mark 75 | #pragma mark Getter 76 | 77 | - (NSMutableArray *)items 78 | { 79 | if (nil == _items) 80 | { 81 | _items = [NSMutableArray array]; 82 | } 83 | return _items; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HaidoraTableViewManager 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/HaidoraTableViewManager.svg?style=flat)](http://cocoapods.org/pods/HaidoraTableViewManager) 4 | [![License](https://img.shields.io/cocoapods/l/HaidoraTableViewManager.svg?style=flat)](http://cocoapods.org/pods/HaidoraTableViewManager) 5 | [![Platform](https://img.shields.io/cocoapods/p/HaidoraTableViewManager.svg?style=flat)](http://cocoapods.org/pods/HaidoraTableViewManager) 6 | 7 | UITableViewDataSource UITableViewDelegate的封装. 8 | 9 | ###UITableView 10 | 11 | ``` 12 | //1.创建TableView和数据 13 | UITableView *tableView = [[UITableView alloc]init]; 14 | tableView.dataSource = self; 15 | tableView.delegate = self; 16 | NSArray *datas = @[@"1",@"2",@"3"]; 17 | 18 | //2.实现相关协议 19 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 20 | { 21 | return datas.count; 22 | } 23 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 24 | { 25 | UITableViewCell *cell = ...; 26 | cell.textLabel.text = datas[indexPath.row]; 27 | return cell; 28 | } 29 | 30 | ``` 31 | 32 | ###HaidoraTableViewManager 33 | 34 | Objc 35 | 36 | ``` 37 | //1.创建TableView和数据 38 | UITableView *tableView = [[UITableView alloc]init]; 39 | NSArray *datas = @[@"1",@"2",@"3"]; 40 | 41 | //2.创建manager 42 | HDTableViewManager *manager = [HDTableViewManager manager]; 43 | //配置cell,类似tableView:numberOfRowsInSection: 44 | manager.cellConfigure = ^(UITableViewCell *cell, id itemData, NSIndexPath *indexPath) { 45 | cell.textLabel.text = 46 | [NSString stringWithFormat:@"index-%@-%@", @(indexPath.section), @(indexPath.row)]; 47 | cell.detailTextLabel.text = 48 | [NSString stringWithFormat:@"subIndex-%@-%@", @(indexPath.section), @(indexPath.row)]; 49 | }; 50 | HDTableViewSection *section = [HDTableViewSection section]; 51 | [section.items addObjectsFromArray:datas]; 52 | 53 | tableView.dataSource = manager; 54 | tableView.delegate = manager; 55 | 56 | ``` 57 | Swift 58 | 59 | ``` 60 | //Swift和OC版本差异性不大,唯一需要注意的是,OC中通过NSStringFromClass([self class])获取类名然后去加载相关的nib。由于在Swift中获取类名会不一样,所以需要手动指定资源 61 | class ViewControllerCell: UITableViewCell { 62 | override class func hd_nibName() -> String { 63 | //nib文件的名称 64 | return "ViewControllerCell" 65 | } 66 | 67 | override class func hd_cellIdentifier() -> String { 68 | //cell复用id 69 | return "ViewControllerCell" 70 | } 71 | } 72 | ``` 73 | 74 | ## Installation 75 | 76 | HaidoraTableViewManager is available through [CocoaPods](http://cocoapods.org). To install 77 | it, simply add the following line to your Podfile: 78 | 79 | ``` 80 | pod "HaidoraTableViewManager" 81 | ``` 82 | * iOS 7.0+ 83 | * Objc/Swift 84 | 85 | ## Inspired by these projects: 86 | * [RetableViewManager](https://github.com/romaonthego/RETableViewManager) 87 | 88 | ## Author 89 | 90 | mrdaios, mrdaios@gmail.com 91 | 92 | ## License 93 | 94 | HaidoraTableViewManager is available under the MIT license. See the LICENSE file for more info. 95 | -------------------------------------------------------------------------------- /_clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | # BasedOnStyle: LLVM 4 | AccessModifierOffset: -2 5 | ConstructorInitializerIndentWidth: 4 6 | AlignEscapedNewlinesLeft: false 7 | AlignTrailingComments: true 8 | AllowAllParametersOfDeclarationOnNextLine: true 9 | AllowShortBlocksOnASingleLine: false 10 | AllowShortIfStatementsOnASingleLine: false 11 | AllowShortLoopsOnASingleLine: false 12 | AllowShortFunctionsOnASingleLine: None 13 | AlwaysBreakTemplateDeclarations: false 14 | AlwaysBreakBeforeMultilineStrings: false 15 | BreakBeforeBinaryOperators: false 16 | BreakBeforeTernaryOperators: true 17 | BreakConstructorInitializersBeforeComma: false 18 | #函数调用参数换行 19 | BinPackParameters: true 20 | #一行多少个字符 21 | ColumnLimit: 100 22 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 23 | DerivePointerBinding: false 24 | ExperimentalAutoDetectBinPacking: false 25 | IndentCaseLabels: false 26 | MaxEmptyLinesToKeep: 1 27 | KeepEmptyLinesAtTheStartOfBlocks: true 28 | NamespaceIndentation: None 29 | ObjCSpaceAfterProperty: false 30 | ObjCSpaceBeforeProtocolList: true 31 | PenaltyBreakBeforeFirstCallParameter: 19 32 | PenaltyBreakComment: 300 33 | PenaltyBreakString: 1000 34 | PenaltyBreakFirstLessLess: 120 35 | PenaltyExcessCharacter: 1000000 36 | PenaltyReturnTypeOnItsOwnLine: 60 37 | PointerBindsToType: false 38 | SpacesBeforeTrailingComments: 1 39 | Cpp11BracedListStyle: true 40 | Standard: Cpp11 41 | #对齐 42 | IndentWidth: 4 43 | TabWidth: 8 44 | UseTab: Never 45 | #{换行方式 46 | BreakBeforeBraces: Allman 47 | IndentFunctionDeclarationAfterType: false 48 | SpacesInParentheses: false 49 | SpacesInAngles: false 50 | SpaceInEmptyParentheses: false 51 | SpacesInCStyleCastParentheses: false 52 | SpaceBeforeAssignmentOperators: true 53 | ContinuationIndentWidth: 4 54 | CommentPragmas: '^ IWYU pragma:' 55 | ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 56 | SpaceBeforeParens: ControlStatements 57 | DisableFormat: false 58 | #objc 59 | ObjCSpaceAfterProperty: true 60 | ObjCSpaceBeforeProtocolList: true 61 | SpacesInContainerLiterals: true 62 | 63 | ... 64 | 65 | --------------------------------------------------------------------------------