├── .gitignore ├── Examples ├── Lazy1.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Lazy1 │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── WELCellConfigure.h │ ├── WELDataSource.h │ ├── WELDataSource.m │ ├── WELTableDelegate.h │ ├── WELTableDelegate.m │ └── main.m ├── Lazy1Tests │ ├── Info.plist │ └── Lazy1Tests.m ├── Main.storyboard ├── ViewController.h ├── ViewController.m ├── WELWordCell+Configure.h ├── WELWordCell+Configure.m ├── WELWordCell.h └── WELWordCell.m ├── README.md └── WELTableHelper ├── WELCellConfigure.h ├── WELDataSource.h ├── WELDataSource.m ├── WELTableDelegate.h └── WELTableDelegate.m /.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 | #Pods/ 27 | -------------------------------------------------------------------------------- /Examples/Lazy1.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2D5FDBD91B24A88B00297996 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDBD81B24A88B00297996 /* main.m */; }; 11 | 2D5FDBDC1B24A88B00297996 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDBDB1B24A88B00297996 /* AppDelegate.m */; }; 12 | 2D5FDBE41B24A88B00297996 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5FDBE31B24A88B00297996 /* Images.xcassets */; }; 13 | 2D5FDBE71B24A88B00297996 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2D5FDBE51B24A88B00297996 /* LaunchScreen.xib */; }; 14 | 2D5FDBF31B24A88B00297996 /* Lazy1Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDBF21B24A88B00297996 /* Lazy1Tests.m */; }; 15 | 2D5FDBFD1B24A8A000297996 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2D5FDBFC1B24A8A000297996 /* Main.storyboard */; }; 16 | 2D5FDC001B24A8C400297996 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDBFF1B24A8C400297996 /* ViewController.m */; }; 17 | 2D5FDC0C1B24A8E400297996 /* WELWordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDC091B24A8E400297996 /* WELWordCell.m */; }; 18 | 2D5FDC0D1B24A8E400297996 /* WELWordCell+Configure.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDC0B1B24A8E400297996 /* WELWordCell+Configure.m */; }; 19 | 2D5FDC171B24AB2800297996 /* WELDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDC141B24AB2800297996 /* WELDataSource.m */; }; 20 | 2D5FDC181B24AB2800297996 /* WELTableDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FDC161B24AB2800297996 /* WELTableDelegate.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 2D5FDBED1B24A88B00297996 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 2D5FDBCB1B24A88A00297996 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 2D5FDBD21B24A88B00297996; 29 | remoteInfo = Lazy1; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 2D5FDBD31B24A88B00297996 /* Lazy1.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Lazy1.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 2D5FDBD71B24A88B00297996 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 2D5FDBD81B24A88B00297996 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | 2D5FDBDA1B24A88B00297996 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | 2D5FDBDB1B24A88B00297996 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | 2D5FDBE31B24A88B00297996 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 2D5FDBE61B24A88B00297996 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | 2D5FDBEC1B24A88B00297996 /* Lazy1Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Lazy1Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 2D5FDBF11B24A88B00297996 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 2D5FDBF21B24A88B00297996 /* Lazy1Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Lazy1Tests.m; sourceTree = ""; }; 44 | 2D5FDBFC1B24A8A000297996 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = ../Main.storyboard; sourceTree = ""; }; 45 | 2D5FDBFE1B24A8C400297996 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = ../ViewController.h; sourceTree = ""; }; 46 | 2D5FDBFF1B24A8C400297996 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = ../ViewController.m; sourceTree = ""; }; 47 | 2D5FDC081B24A8E400297996 /* WELWordCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WELWordCell.h; path = ../WELWordCell.h; sourceTree = ""; }; 48 | 2D5FDC091B24A8E400297996 /* WELWordCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WELWordCell.m; path = ../WELWordCell.m; sourceTree = ""; }; 49 | 2D5FDC0A1B24A8E400297996 /* WELWordCell+Configure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "WELWordCell+Configure.h"; path = "../WELWordCell+Configure.h"; sourceTree = ""; }; 50 | 2D5FDC0B1B24A8E400297996 /* WELWordCell+Configure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "WELWordCell+Configure.m"; path = "../WELWordCell+Configure.m"; sourceTree = ""; }; 51 | 2D5FDC121B24AB2800297996 /* WELCellConfigure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WELCellConfigure.h; sourceTree = ""; }; 52 | 2D5FDC131B24AB2800297996 /* WELDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WELDataSource.h; sourceTree = ""; }; 53 | 2D5FDC141B24AB2800297996 /* WELDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WELDataSource.m; sourceTree = ""; }; 54 | 2D5FDC151B24AB2800297996 /* WELTableDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WELTableDelegate.h; sourceTree = ""; }; 55 | 2D5FDC161B24AB2800297996 /* WELTableDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WELTableDelegate.m; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 2D5FDBD01B24A88B00297996 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 2D5FDBE91B24A88B00297996 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 2D5FDBCA1B24A88A00297996 = { 77 | isa = PBXGroup; 78 | children = ( 79 | 2D5FDBD51B24A88B00297996 /* Lazy1 */, 80 | 2D5FDBEF1B24A88B00297996 /* Lazy1Tests */, 81 | 2D5FDBD41B24A88B00297996 /* Products */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | 2D5FDBD41B24A88B00297996 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 2D5FDBD31B24A88B00297996 /* Lazy1.app */, 89 | 2D5FDBEC1B24A88B00297996 /* Lazy1Tests.xctest */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | 2D5FDBD51B24A88B00297996 /* Lazy1 */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 2D5FDC0E1B24A8EA00297996 /* WELTableHelper */, 98 | 2D5FDC0F1B24A91100297996 /* Cell */, 99 | 2D5FDBFE1B24A8C400297996 /* ViewController.h */, 100 | 2D5FDBFF1B24A8C400297996 /* ViewController.m */, 101 | 2D5FDBDA1B24A88B00297996 /* AppDelegate.h */, 102 | 2D5FDBDB1B24A88B00297996 /* AppDelegate.m */, 103 | 2D5FDBFC1B24A8A000297996 /* Main.storyboard */, 104 | 2D5FDBE51B24A88B00297996 /* LaunchScreen.xib */, 105 | 2D5FDBE31B24A88B00297996 /* Images.xcassets */, 106 | 2D5FDBD61B24A88B00297996 /* Supporting Files */, 107 | ); 108 | path = Lazy1; 109 | sourceTree = ""; 110 | }; 111 | 2D5FDBD61B24A88B00297996 /* Supporting Files */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 2D5FDBD71B24A88B00297996 /* Info.plist */, 115 | 2D5FDBD81B24A88B00297996 /* main.m */, 116 | ); 117 | name = "Supporting Files"; 118 | sourceTree = ""; 119 | }; 120 | 2D5FDBEF1B24A88B00297996 /* Lazy1Tests */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 2D5FDBF21B24A88B00297996 /* Lazy1Tests.m */, 124 | 2D5FDBF01B24A88B00297996 /* Supporting Files */, 125 | ); 126 | path = Lazy1Tests; 127 | sourceTree = ""; 128 | }; 129 | 2D5FDBF01B24A88B00297996 /* Supporting Files */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 2D5FDBF11B24A88B00297996 /* Info.plist */, 133 | ); 134 | name = "Supporting Files"; 135 | sourceTree = ""; 136 | }; 137 | 2D5FDC0E1B24A8EA00297996 /* WELTableHelper */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 2D5FDC121B24AB2800297996 /* WELCellConfigure.h */, 141 | 2D5FDC131B24AB2800297996 /* WELDataSource.h */, 142 | 2D5FDC141B24AB2800297996 /* WELDataSource.m */, 143 | 2D5FDC151B24AB2800297996 /* WELTableDelegate.h */, 144 | 2D5FDC161B24AB2800297996 /* WELTableDelegate.m */, 145 | ); 146 | name = WELTableHelper; 147 | sourceTree = ""; 148 | }; 149 | 2D5FDC0F1B24A91100297996 /* Cell */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 2D5FDC081B24A8E400297996 /* WELWordCell.h */, 153 | 2D5FDC091B24A8E400297996 /* WELWordCell.m */, 154 | 2D5FDC0A1B24A8E400297996 /* WELWordCell+Configure.h */, 155 | 2D5FDC0B1B24A8E400297996 /* WELWordCell+Configure.m */, 156 | ); 157 | name = Cell; 158 | sourceTree = ""; 159 | }; 160 | /* End PBXGroup section */ 161 | 162 | /* Begin PBXNativeTarget section */ 163 | 2D5FDBD21B24A88B00297996 /* Lazy1 */ = { 164 | isa = PBXNativeTarget; 165 | buildConfigurationList = 2D5FDBF61B24A88B00297996 /* Build configuration list for PBXNativeTarget "Lazy1" */; 166 | buildPhases = ( 167 | 2D5FDBCF1B24A88B00297996 /* Sources */, 168 | 2D5FDBD01B24A88B00297996 /* Frameworks */, 169 | 2D5FDBD11B24A88B00297996 /* Resources */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | ); 175 | name = Lazy1; 176 | productName = Lazy1; 177 | productReference = 2D5FDBD31B24A88B00297996 /* Lazy1.app */; 178 | productType = "com.apple.product-type.application"; 179 | }; 180 | 2D5FDBEB1B24A88B00297996 /* Lazy1Tests */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = 2D5FDBF91B24A88B00297996 /* Build configuration list for PBXNativeTarget "Lazy1Tests" */; 183 | buildPhases = ( 184 | 2D5FDBE81B24A88B00297996 /* Sources */, 185 | 2D5FDBE91B24A88B00297996 /* Frameworks */, 186 | 2D5FDBEA1B24A88B00297996 /* Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | 2D5FDBEE1B24A88B00297996 /* PBXTargetDependency */, 192 | ); 193 | name = Lazy1Tests; 194 | productName = Lazy1Tests; 195 | productReference = 2D5FDBEC1B24A88B00297996 /* Lazy1Tests.xctest */; 196 | productType = "com.apple.product-type.bundle.unit-test"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | 2D5FDBCB1B24A88A00297996 /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastUpgradeCheck = 0630; 205 | ORGANIZATIONNAME = WELCommand; 206 | TargetAttributes = { 207 | 2D5FDBD21B24A88B00297996 = { 208 | CreatedOnToolsVersion = 6.3.2; 209 | }; 210 | 2D5FDBEB1B24A88B00297996 = { 211 | CreatedOnToolsVersion = 6.3.2; 212 | TestTargetID = 2D5FDBD21B24A88B00297996; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = 2D5FDBCE1B24A88A00297996 /* Build configuration list for PBXProject "Lazy1" */; 217 | compatibilityVersion = "Xcode 3.2"; 218 | developmentRegion = English; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | Base, 223 | ); 224 | mainGroup = 2D5FDBCA1B24A88A00297996; 225 | productRefGroup = 2D5FDBD41B24A88B00297996 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | 2D5FDBD21B24A88B00297996 /* Lazy1 */, 230 | 2D5FDBEB1B24A88B00297996 /* Lazy1Tests */, 231 | ); 232 | }; 233 | /* End PBXProject section */ 234 | 235 | /* Begin PBXResourcesBuildPhase section */ 236 | 2D5FDBD11B24A88B00297996 /* Resources */ = { 237 | isa = PBXResourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 2D5FDBFD1B24A8A000297996 /* Main.storyboard in Resources */, 241 | 2D5FDBE71B24A88B00297996 /* LaunchScreen.xib in Resources */, 242 | 2D5FDBE41B24A88B00297996 /* Images.xcassets in Resources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | 2D5FDBEA1B24A88B00297996 /* Resources */ = { 247 | isa = PBXResourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | /* End PBXResourcesBuildPhase section */ 254 | 255 | /* Begin PBXSourcesBuildPhase section */ 256 | 2D5FDBCF1B24A88B00297996 /* Sources */ = { 257 | isa = PBXSourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 2D5FDC0C1B24A8E400297996 /* WELWordCell.m in Sources */, 261 | 2D5FDC0D1B24A8E400297996 /* WELWordCell+Configure.m in Sources */, 262 | 2D5FDC181B24AB2800297996 /* WELTableDelegate.m in Sources */, 263 | 2D5FDC001B24A8C400297996 /* ViewController.m in Sources */, 264 | 2D5FDBDC1B24A88B00297996 /* AppDelegate.m in Sources */, 265 | 2D5FDBD91B24A88B00297996 /* main.m in Sources */, 266 | 2D5FDC171B24AB2800297996 /* WELDataSource.m in Sources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | 2D5FDBE81B24A88B00297996 /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | 2D5FDBF31B24A88B00297996 /* Lazy1Tests.m in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | /* End PBXSourcesBuildPhase section */ 279 | 280 | /* Begin PBXTargetDependency section */ 281 | 2D5FDBEE1B24A88B00297996 /* PBXTargetDependency */ = { 282 | isa = PBXTargetDependency; 283 | target = 2D5FDBD21B24A88B00297996 /* Lazy1 */; 284 | targetProxy = 2D5FDBED1B24A88B00297996 /* PBXContainerItemProxy */; 285 | }; 286 | /* End PBXTargetDependency section */ 287 | 288 | /* Begin PBXVariantGroup section */ 289 | 2D5FDBE51B24A88B00297996 /* LaunchScreen.xib */ = { 290 | isa = PBXVariantGroup; 291 | children = ( 292 | 2D5FDBE61B24A88B00297996 /* Base */, 293 | ); 294 | name = LaunchScreen.xib; 295 | sourceTree = ""; 296 | }; 297 | /* End PBXVariantGroup section */ 298 | 299 | /* Begin XCBuildConfiguration section */ 300 | 2D5FDBF41B24A88B00297996 /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ALWAYS_SEARCH_USER_PATHS = NO; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_WARN_BOOL_CONVERSION = YES; 309 | CLANG_WARN_CONSTANT_CONVERSION = YES; 310 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 311 | CLANG_WARN_EMPTY_BODY = YES; 312 | CLANG_WARN_ENUM_CONVERSION = YES; 313 | CLANG_WARN_INT_CONVERSION = YES; 314 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 315 | CLANG_WARN_UNREACHABLE_CODE = YES; 316 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 317 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 318 | COPY_PHASE_STRIP = NO; 319 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 320 | ENABLE_STRICT_OBJC_MSGSEND = YES; 321 | GCC_C_LANGUAGE_STANDARD = gnu99; 322 | GCC_DYNAMIC_NO_PIC = NO; 323 | GCC_NO_COMMON_BLOCKS = YES; 324 | GCC_OPTIMIZATION_LEVEL = 0; 325 | GCC_PREPROCESSOR_DEFINITIONS = ( 326 | "DEBUG=1", 327 | "$(inherited)", 328 | ); 329 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 330 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 331 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 332 | GCC_WARN_UNDECLARED_SELECTOR = YES; 333 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 334 | GCC_WARN_UNUSED_FUNCTION = YES; 335 | GCC_WARN_UNUSED_VARIABLE = YES; 336 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 337 | MTL_ENABLE_DEBUG_INFO = YES; 338 | ONLY_ACTIVE_ARCH = YES; 339 | SDKROOT = iphoneos; 340 | }; 341 | name = Debug; 342 | }; 343 | 2D5FDBF51B24A88B00297996 /* Release */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ALWAYS_SEARCH_USER_PATHS = NO; 347 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 348 | CLANG_CXX_LIBRARY = "libc++"; 349 | CLANG_ENABLE_MODULES = YES; 350 | CLANG_ENABLE_OBJC_ARC = YES; 351 | CLANG_WARN_BOOL_CONVERSION = YES; 352 | CLANG_WARN_CONSTANT_CONVERSION = YES; 353 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 354 | CLANG_WARN_EMPTY_BODY = YES; 355 | CLANG_WARN_ENUM_CONVERSION = YES; 356 | CLANG_WARN_INT_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 363 | ENABLE_NS_ASSERTIONS = NO; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 374 | MTL_ENABLE_DEBUG_INFO = NO; 375 | SDKROOT = iphoneos; 376 | VALIDATE_PRODUCT = YES; 377 | }; 378 | name = Release; 379 | }; 380 | 2D5FDBF71B24A88B00297996 /* Debug */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 384 | INFOPLIST_FILE = Lazy1/Info.plist; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | }; 388 | name = Debug; 389 | }; 390 | 2D5FDBF81B24A88B00297996 /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 394 | INFOPLIST_FILE = Lazy1/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | }; 398 | name = Release; 399 | }; 400 | 2D5FDBFA1B24A88B00297996 /* Debug */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | BUNDLE_LOADER = "$(TEST_HOST)"; 404 | FRAMEWORK_SEARCH_PATHS = ( 405 | "$(SDKROOT)/Developer/Library/Frameworks", 406 | "$(inherited)", 407 | ); 408 | GCC_PREPROCESSOR_DEFINITIONS = ( 409 | "DEBUG=1", 410 | "$(inherited)", 411 | ); 412 | INFOPLIST_FILE = Lazy1Tests/Info.plist; 413 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Lazy1.app/Lazy1"; 416 | }; 417 | name = Debug; 418 | }; 419 | 2D5FDBFB1B24A88B00297996 /* Release */ = { 420 | isa = XCBuildConfiguration; 421 | buildSettings = { 422 | BUNDLE_LOADER = "$(TEST_HOST)"; 423 | FRAMEWORK_SEARCH_PATHS = ( 424 | "$(SDKROOT)/Developer/Library/Frameworks", 425 | "$(inherited)", 426 | ); 427 | INFOPLIST_FILE = Lazy1Tests/Info.plist; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Lazy1.app/Lazy1"; 431 | }; 432 | name = Release; 433 | }; 434 | /* End XCBuildConfiguration section */ 435 | 436 | /* Begin XCConfigurationList section */ 437 | 2D5FDBCE1B24A88A00297996 /* Build configuration list for PBXProject "Lazy1" */ = { 438 | isa = XCConfigurationList; 439 | buildConfigurations = ( 440 | 2D5FDBF41B24A88B00297996 /* Debug */, 441 | 2D5FDBF51B24A88B00297996 /* Release */, 442 | ); 443 | defaultConfigurationIsVisible = 0; 444 | defaultConfigurationName = Release; 445 | }; 446 | 2D5FDBF61B24A88B00297996 /* Build configuration list for PBXNativeTarget "Lazy1" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | 2D5FDBF71B24A88B00297996 /* Debug */, 450 | 2D5FDBF81B24A88B00297996 /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | defaultConfigurationName = Release; 454 | }; 455 | 2D5FDBF91B24A88B00297996 /* Build configuration list for PBXNativeTarget "Lazy1Tests" */ = { 456 | isa = XCConfigurationList; 457 | buildConfigurations = ( 458 | 2D5FDBFA1B24A88B00297996 /* Debug */, 459 | 2D5FDBFB1B24A88B00297996 /* Release */, 460 | ); 461 | defaultConfigurationIsVisible = 0; 462 | defaultConfigurationName = Release; 463 | }; 464 | /* End XCConfigurationList section */ 465 | }; 466 | rootObject = 2D5FDBCB1B24A88A00297996 /* Project object */; 467 | } 468 | -------------------------------------------------------------------------------- /Examples/Lazy1.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Lazy1/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Lazy1 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Examples/Lazy1/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Lazy1 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Examples/Lazy1/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Examples/Lazy1/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Examples/Lazy1/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.welcommand.www.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Examples/Lazy1/WELCellConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELCellConfigure.h 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/6/7. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol WELCellConfigure 12 | 13 | -(void)configureCellWithModel:(id)model; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/Lazy1/WELDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELDataSource.h 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/5/31. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WELCellConfigure.h" 11 | 12 | 13 | 14 | typedef void (^CellConfigureBefore)(id cell, id model, NSIndexPath * indexPath); 15 | 16 | 17 | IB_DESIGNABLE 18 | @interface WELDataSource : NSObject 19 | 20 | //--------- For Code 21 | - (id)initWithIdentifier:(NSString *)identifier configureBlock:(CellConfigureBefore)before; 22 | 23 | //--------- For StoryBoard 24 | 25 | @property (nonatomic, strong) IBInspectable NSString *cellIdentifier; 26 | 27 | @property (nonatomic, copy) CellConfigureBefore cellConfigureBefore; 28 | 29 | //---------Public 30 | 31 | - (void)addModels:(NSArray *)models; 32 | 33 | - (id)modelsAtIndexPath:(NSIndexPath *)indexPath; 34 | 35 | 36 | 37 | @end -------------------------------------------------------------------------------- /Examples/Lazy1/WELDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // WELDataSource.m 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/5/31. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "WELDataSource.h" 10 | 11 | @interface WELDataSource () { 12 | NSMutableArray *m_Models; 13 | } 14 | 15 | @end 16 | 17 | @implementation WELDataSource 18 | 19 | 20 | - (id)initWithIdentifier:(NSString *)identifier configureBlock:(CellConfigureBefore)before { 21 | if(self = [super init]) { 22 | _cellIdentifier = identifier; 23 | _cellConfigureBefore = [before copy]; 24 | } 25 | return self; 26 | } 27 | 28 | - (void)addModels:(NSArray *)models { 29 | if(!models) return; 30 | if(!m_Models) { 31 | m_Models = [[NSMutableArray alloc] init]; 32 | } 33 | [m_Models addObjectsFromArray:models]; 34 | } 35 | 36 | - (id)modelsAtIndexPath:(NSIndexPath *)indexPath { 37 | return m_Models.count > indexPath.row ? m_Models[indexPath.row] : nil; 38 | } 39 | 40 | #pragma mark UITableViewDataSource 41 | 42 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 43 | { 44 | return m_Models == nil ? 0: m_Models.count; 45 | } 46 | 47 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 48 | { 49 | 50 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier 51 | forIndexPath:indexPath]; 52 | id model = [self modelsAtIndexPath:indexPath]; 53 | 54 | 55 | if(self.cellConfigureBefore) { 56 | self.cellConfigureBefore(cell, model,indexPath); 57 | } 58 | if ([cell respondsToSelector:@selector(configureCellWithModel:)]) { 59 | [cell performSelector:@selector(configureCellWithModel:) withObject:model]; 60 | } 61 | 62 | return cell; 63 | } 64 | 65 | #pragma mark UICollectionViewDataSource 66 | 67 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 68 | { 69 | return m_Models == nil ? 0: m_Models.count; 70 | } 71 | 72 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 73 | { 74 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:self.cellIdentifier forIndexPath:indexPath]; 75 | id model = [self modelsAtIndexPath:indexPath]; 76 | 77 | if(self.cellConfigureBefore) { 78 | self.cellConfigureBefore(cell, model,indexPath); 79 | } 80 | if ([cell respondsToSelector:@selector(configureCellWithModel:)]) { 81 | [cell performSelector:@selector(configureCellWithModel:) withObject:model]; 82 | } 83 | return cell; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Examples/Lazy1/WELTableDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELTableDelegate.h 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/6/6. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WELTableDelegate : NSObject 13 | 14 | @property (nonatomic, weak) IBOutlet id viewController; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/Lazy1/WELTableDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // WELTableDelegate.m 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/6/6. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "WELTableDelegate.h" 10 | 11 | @implementation WELTableDelegate 12 | 13 | - (id)forwardingTargetForSelector:(SEL)aSelector { 14 | 15 | if([super respondsToSelector:aSelector]) { 16 | return self; 17 | } else if ([self.viewController respondsToSelector:aSelector]) { 18 | return self.viewController; 19 | } 20 | return self; 21 | } 22 | 23 | 24 | - (BOOL)respondsToSelector:(SEL)aSelector 25 | { 26 | return [super respondsToSelector:aSelector] || [self.viewController respondsToSelector:aSelector]; 27 | } 28 | 29 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 30 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 31 | 32 | if([self respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]) { 33 | [self.viewController tableView:tableView didSelectRowAtIndexPath:indexPath]; 34 | } 35 | } 36 | 37 | -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 38 | 39 | if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) { 40 | [tableView setSeparatorInset:UIEdgeInsetsZero]; 41 | } 42 | 43 | if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) { 44 | [tableView setLayoutMargins:UIEdgeInsetsZero]; 45 | } 46 | 47 | if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { 48 | [cell setLayoutMargins:UIEdgeInsetsZero]; 49 | } 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Examples/Lazy1/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Lazy1 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/Lazy1Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.welcommand.www.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Examples/Lazy1Tests/Lazy1Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Lazy1Tests.m 3 | // Lazy1Tests 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface Lazy1Tests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation Lazy1Tests 17 | 18 | - (void)setUp { 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 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Examples/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 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /Examples/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/5/30. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Examples/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/5/30. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "WELDataSource.h" 11 | #import "WELTableDelegate.h" 12 | 13 | @interface ViewController () 14 | 15 | @property (weak, nonatomic) IBOutlet UITableView *table; 16 | 17 | @property (strong, nonatomic) IBOutlet WELDataSource *dataDelegate; 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | [_dataDelegate addModels:@[@"a",@"b",@"c",@"d"]]; 27 | [_table reloadData]; 28 | _table.delegate = self; 29 | } 30 | 31 | 32 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 33 | NSLog(@"select"); 34 | } 35 | 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Examples/WELWordCell+Configure.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELWordCell+Configure.h 3 | // test_fount 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "WELWordCell.h" 10 | #import "WELCellConfigure.h" 11 | 12 | @interface WELWordCell (Configure) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Examples/WELWordCell+Configure.m: -------------------------------------------------------------------------------- 1 | // 2 | // WELWordCell+Configure.m 3 | // test_fount 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "WELWordCell+Configure.h" 10 | 11 | @implementation WELWordCell (Configure) 12 | 13 | -(void)configureCellWithModel:(id)model { 14 | self.wordLabel.text = model; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Examples/WELWordCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELWordCell.h 3 | // test_fount 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WELWordCell : UITableViewCell 12 | @property (weak, nonatomic) IBOutlet UILabel *wordLabel; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Examples/WELWordCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // WELWordCell.m 3 | // test_fount 4 | // 5 | // Created by WELCommand on 15/6/8. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "WELWordCell.h" 10 | 11 | @implementation WELWordCell 12 | 13 | - (void)awakeFromNib { 14 | // Initialization code 15 | } 16 | 17 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 18 | [super setSelected:selected animated:animated]; 19 | 20 | // Configure the view for the selected state 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WELTableHelper 2 | Examples of the blog. 3 | 4 | Easy to use UITableView . 5 | -------------------------------------------------------------------------------- /WELTableHelper/WELCellConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELCellConfigure.h 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/6/7. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^ CellEventIntermediary)(NSString *eventID,id sender); 12 | 13 | @protocol WELCellConfigure 14 | 15 | 16 | -(void)configureCellWithModel:(id)model; 17 | 18 | @optional 19 | //------state 20 | -(void)configureCellStateWithModel:(id)stateModel; 21 | 22 | //-------event 23 | @property (nonatomic, copy) CellEventIntermediary eventIntermediary; 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WELTableHelper/WELDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELDataSource.h 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/5/31. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WELCellConfigure.h" 11 | 12 | typedef void (^CellConfigureBefore)(id cell, id model, NSIndexPath * indexPath); 13 | 14 | @interface WELDataSource : NSObject 15 | 16 | //--------- For Code 17 | - (id)initWithIdentifier:(NSString *)identifier configureBlock:(CellConfigureBefore)before; 18 | 19 | - (id)initWithIdentifier:(NSString *)identifier configureBlock:(CellConfigureBefore)before stateModelClass:(NSString *)stateModelClass; 20 | 21 | //--------- For StoryBoard not use in code 22 | 23 | @property (nonatomic, strong) IBInspectable NSString *cellIdentifier; 24 | @property (nonatomic, strong) IBInspectable NSString *cellStateModelClass; 25 | @property (nonatomic, copy) CellConfigureBefore cellConfigureBefore; 26 | 27 | //---------Public 28 | 29 | - (void)addModels:(NSArray *)models; 30 | 31 | - (id)modelsAtIndexPath:(NSIndexPath *)indexPath; 32 | 33 | - (void)registEvenIntermediary:(CellEventIntermediary)block; 34 | 35 | @end -------------------------------------------------------------------------------- /WELTableHelper/WELDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // WELDataSource.m 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/5/31. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "WELDataSource.h" 10 | 11 | @interface WELDataSource () 12 | 13 | @property (nonatomic, strong) NSMutableArray *models; 14 | @property (nonatomic, strong) NSMutableArray *stateModels; 15 | 16 | @property (nonatomic, copy) CellEventIntermediary eventBlock; 17 | 18 | @end 19 | 20 | @implementation WELDataSource 21 | 22 | - (id)initWithIdentifier:(NSString *)identifier configureBlock:(CellConfigureBefore)before { 23 | return [self initWithIdentifier:identifier configureBlock:before stateModelClass:@""]; 24 | } 25 | 26 | - (id)initWithIdentifier:(NSString *)identifier configureBlock:(CellConfigureBefore)before stateModelClass:(NSString *)stateModelClass { 27 | if(self = [super init]) { 28 | _cellIdentifier = identifier; 29 | _cellConfigureBefore = [before copy]; 30 | _cellStateModelClass = stateModelClass; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)addModels:(NSArray *)models { 36 | if(!models) return; 37 | [self.models addObjectsFromArray:models]; 38 | [self addStateModelsWithCount:models.count]; 39 | } 40 | 41 | - (id)modelsAtIndexPath:(NSIndexPath *)indexPath { 42 | return [self.models objectAtIndex:indexPath.row]; 43 | } 44 | 45 | -(void)addStateModelsWithCount:(NSInteger)count{ 46 | if(!_cellStateModelClass || [_cellStateModelClass isEqualToString:@""]) { 47 | return; 48 | } 49 | 50 | for(NSInteger i = 0 ; i < count; i++){ 51 | Class sm = NSClassFromString(_cellStateModelClass); 52 | id smobj = [[sm alloc] init]; 53 | [self.stateModels addObject:smobj]; 54 | } 55 | } 56 | 57 | - (id)stateModelsAtIndexPath:(NSIndexPath *)indexPath { 58 | return [self.stateModels objectAtIndex:indexPath.row]; 59 | } 60 | 61 | - (void)registEvenIntermediary:(CellEventIntermediary)block { 62 | self.eventBlock = block; 63 | } 64 | 65 | #pragma mark UITableViewDataSource 66 | 67 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 68 | { 69 | return self.models.count; 70 | } 71 | 72 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 73 | { 74 | 75 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier 76 | forIndexPath:indexPath]; 77 | id model = [self modelsAtIndexPath:indexPath]; 78 | 79 | 80 | if(self.cellConfigureBefore) { 81 | self.cellConfigureBefore(cell, model,indexPath); 82 | } 83 | if ([cell respondsToSelector:@selector(configureCellWithModel:)]) { 84 | [cell performSelector:@selector(configureCellWithModel:) withObject:model]; 85 | } 86 | 87 | if([cell respondsToSelector:@selector(configureCellStateWithModel:)]) { 88 | [cell performSelector:@selector(configureCellStateWithModel:) withObject:[self stateModelsAtIndexPath:indexPath]]; 89 | } 90 | 91 | if([cell respondsToSelector:@selector(setEventIntermediary:)]) { 92 | [cell performSelector:@selector(setEventIntermediary:) withObject:self.eventBlock]; 93 | } 94 | 95 | return cell; 96 | } 97 | 98 | #pragma mark UICollectionViewDataSource 99 | 100 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 101 | { 102 | return self.models.count; 103 | } 104 | 105 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 106 | { 107 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:self.cellIdentifier forIndexPath:indexPath]; 108 | id model = [self modelsAtIndexPath:indexPath]; 109 | 110 | if(self.cellConfigureBefore) { 111 | self.cellConfigureBefore(cell, model,indexPath); 112 | } 113 | if ([cell respondsToSelector:@selector(configureCellWithModel:)]) { 114 | [cell performSelector:@selector(configureCellWithModel:) withObject:model]; 115 | } 116 | 117 | if([cell respondsToSelector:@selector(configureCellStateWithModel:)]) { 118 | [cell performSelector:@selector(configureCellStateWithModel:) withObject:[self stateModelsAtIndexPath:indexPath]]; 119 | } 120 | 121 | if([cell respondsToSelector:@selector(setEventIntermediary:)]) { 122 | [cell performSelector:@selector(setEventIntermediary:) withObject:self.eventBlock]; 123 | } 124 | 125 | 126 | 127 | return cell; 128 | } 129 | 130 | 131 | #pragma mark- 132 | #pragma mark- get/set 133 | 134 | -(NSMutableArray *)models { 135 | if(!_models) { 136 | _models = [[NSMutableArray alloc] init]; 137 | } 138 | return _models; 139 | } 140 | 141 | -(NSMutableArray *)stateModels { 142 | if(!_stateModels){ 143 | _stateModels = [[NSMutableArray alloc] init]; 144 | } 145 | return _stateModels; 146 | } 147 | 148 | -(void)setCellIdentifier:(NSString *)cellIdentifier { 149 | if(_cellIdentifier) return; 150 | _cellIdentifier = cellIdentifier; 151 | } 152 | 153 | -(void)setCellStateModelClass:(NSString *)cellStateModelClass { 154 | if(_cellStateModelClass) return; 155 | _cellStateModelClass = cellStateModelClass; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /WELTableHelper/WELTableDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WELTableDelegate.h 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/6/6. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WELTableDelegate : NSObject 13 | 14 | @property (nonatomic, weak) IBOutlet id viewController; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WELTableHelper/WELTableDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // WELTableDelegate.m 3 | // WELCommand 4 | // 5 | // Created by WELCommand on 15/6/6. 6 | // Copyright (c) 2015年 WELCommand. All rights reserved. 7 | // 8 | 9 | #import "WELTableDelegate.h" 10 | 11 | @implementation WELTableDelegate 12 | 13 | - (id)forwardingTargetForSelector:(SEL)aSelector { 14 | 15 | if([super respondsToSelector:aSelector]) { 16 | return self; 17 | } else if ([self.viewController respondsToSelector:aSelector]) { 18 | return self.viewController; 19 | } 20 | return self; 21 | } 22 | 23 | 24 | - (BOOL)respondsToSelector:(SEL)aSelector 25 | { 26 | return [super respondsToSelector:aSelector] || [self.viewController respondsToSelector:aSelector]; 27 | } 28 | 29 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 30 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 31 | 32 | if([self respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]) { 33 | [self.viewController tableView:tableView didSelectRowAtIndexPath:indexPath]; 34 | } 35 | } 36 | 37 | -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 38 | 39 | if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) { 40 | [tableView setSeparatorInset:UIEdgeInsetsZero]; 41 | } 42 | 43 | if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) { 44 | [tableView setLayoutMargins:UIEdgeInsetsZero]; 45 | } 46 | 47 | if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { 48 | [cell setLayoutMargins:UIEdgeInsetsZero]; 49 | } 50 | } 51 | 52 | 53 | @end 54 | --------------------------------------------------------------------------------