├── .gitignore ├── HDTableViewMaker.podspec ├── HDTableViewMaker ├── HDBaseTableViewDataSource.h ├── HDBaseTableViewDataSource.m ├── HDCellData.h ├── HDCellData.m ├── HDCellMaker.h ├── HDCellMaker.m ├── HDSectionData.h ├── HDSectionData.m ├── HDSectionMaker.h ├── HDSectionMaker.m ├── HDTMCommonHeader.h ├── HDTableData.h ├── HDTableData.m ├── HDTableViewMaker.bundle │ ├── hd_tm_empty_icon@2x.png │ └── hd_tm_error_icon@2x.png ├── HDTableViewMaker.h ├── HDTableViewMaker.m ├── HDTableViewMakerHeader.h ├── NSBundle+HDTableViewMaker.h ├── NSBundle+HDTableViewMaker.m ├── NSObject+HDAssociated.h ├── NSObject+HDAssociated.m ├── UITableView+HDCover.h ├── UITableView+HDCover.m ├── UITableView+HDFreshUI.h ├── UITableView+HDFreshUI.m ├── UITableView+HDOperating.h ├── UITableView+HDOperating.m ├── UITableView+HDTableViewMaker.h ├── UITableView+HDTableViewMaker.m ├── UITableViewCell+HDTableViewMaker.h └── UITableViewCell+HDTableViewMaker.m ├── HDTableViewMakerDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── HDTableViewMakerDemo.xcworkspace └── contents.xcworkspacedata ├── HDTableViewMakerDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Cell │ ├── HDTableViewCell.h │ ├── HDTableViewCell.m │ └── HDTableViewCell.xib ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ ├── Private │ │ ├── MJRefresh │ │ │ ├── MJRefresh.h │ │ │ ├── MJRefreshAutoFooter.h │ │ │ ├── MJRefreshAutoGifFooter.h │ │ │ ├── MJRefreshAutoNormalFooter.h │ │ │ ├── MJRefreshAutoStateFooter.h │ │ │ ├── MJRefreshBackFooter.h │ │ │ ├── MJRefreshBackGifFooter.h │ │ │ ├── MJRefreshBackNormalFooter.h │ │ │ ├── MJRefreshBackStateFooter.h │ │ │ ├── MJRefreshComponent.h │ │ │ ├── MJRefreshConst.h │ │ │ ├── MJRefreshFooter.h │ │ │ ├── MJRefreshGifHeader.h │ │ │ ├── MJRefreshHeader.h │ │ │ ├── MJRefreshNormalHeader.h │ │ │ ├── MJRefreshStateHeader.h │ │ │ ├── NSBundle+MJRefresh.h │ │ │ ├── UIScrollView+MJExtension.h │ │ │ ├── UIScrollView+MJRefresh.h │ │ │ └── UIView+MJExtension.h │ │ ├── Masonry │ │ │ ├── MASCompositeConstraint.h │ │ │ ├── MASConstraint+Private.h │ │ │ ├── MASConstraint.h │ │ │ ├── MASConstraintMaker.h │ │ │ ├── MASLayoutConstraint.h │ │ │ ├── MASUtilities.h │ │ │ ├── MASViewAttribute.h │ │ │ ├── MASViewConstraint.h │ │ │ ├── Masonry.h │ │ │ ├── NSArray+MASAdditions.h │ │ │ ├── NSArray+MASShorthandAdditions.h │ │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ │ ├── View+MASAdditions.h │ │ │ ├── View+MASShorthandAdditions.h │ │ │ └── ViewController+MASAdditions.h │ │ └── UITableView+FDTemplateLayoutCell │ │ │ ├── UITableView+FDIndexPathHeightCache.h │ │ │ ├── UITableView+FDKeyedHeightCache.h │ │ │ ├── UITableView+FDTemplateLayoutCell.h │ │ │ └── UITableView+FDTemplateLayoutCellDebug.h │ └── Public │ │ ├── MJRefresh │ │ ├── MJRefresh.h │ │ ├── MJRefreshAutoFooter.h │ │ ├── MJRefreshAutoGifFooter.h │ │ ├── MJRefreshAutoNormalFooter.h │ │ ├── MJRefreshAutoStateFooter.h │ │ ├── MJRefreshBackFooter.h │ │ ├── MJRefreshBackGifFooter.h │ │ ├── MJRefreshBackNormalFooter.h │ │ ├── MJRefreshBackStateFooter.h │ │ ├── MJRefreshComponent.h │ │ ├── MJRefreshConst.h │ │ ├── MJRefreshFooter.h │ │ ├── MJRefreshGifHeader.h │ │ ├── MJRefreshHeader.h │ │ ├── MJRefreshNormalHeader.h │ │ ├── MJRefreshStateHeader.h │ │ ├── NSBundle+MJRefresh.h │ │ ├── UIScrollView+MJExtension.h │ │ ├── UIScrollView+MJRefresh.h │ │ └── UIView+MJExtension.h │ │ ├── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraintMaker.h │ │ ├── MASLayoutConstraint.h │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewConstraint.h │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── View+MASAdditions.h │ │ ├── View+MASShorthandAdditions.h │ │ └── ViewController+MASAdditions.h │ │ └── UITableView+FDTemplateLayoutCell │ │ ├── UITableView+FDIndexPathHeightCache.h │ │ ├── UITableView+FDKeyedHeightCache.h │ │ ├── UITableView+FDTemplateLayoutCell.h │ │ └── UITableView+FDTemplateLayoutCellDebug.h ├── MJRefresh │ ├── LICENSE │ ├── MJRefresh │ │ ├── Base │ │ │ ├── MJRefreshAutoFooter.h │ │ │ ├── MJRefreshAutoFooter.m │ │ │ ├── MJRefreshBackFooter.h │ │ │ ├── MJRefreshBackFooter.m │ │ │ ├── MJRefreshComponent.h │ │ │ ├── MJRefreshComponent.m │ │ │ ├── MJRefreshFooter.h │ │ │ ├── MJRefreshFooter.m │ │ │ ├── MJRefreshHeader.h │ │ │ └── MJRefreshHeader.m │ │ ├── Custom │ │ │ ├── Footer │ │ │ │ ├── Auto │ │ │ │ │ ├── MJRefreshAutoGifFooter.h │ │ │ │ │ ├── MJRefreshAutoGifFooter.m │ │ │ │ │ ├── MJRefreshAutoNormalFooter.h │ │ │ │ │ ├── MJRefreshAutoNormalFooter.m │ │ │ │ │ ├── MJRefreshAutoStateFooter.h │ │ │ │ │ └── MJRefreshAutoStateFooter.m │ │ │ │ └── Back │ │ │ │ │ ├── MJRefreshBackGifFooter.h │ │ │ │ │ ├── MJRefreshBackGifFooter.m │ │ │ │ │ ├── MJRefreshBackNormalFooter.h │ │ │ │ │ ├── MJRefreshBackNormalFooter.m │ │ │ │ │ ├── MJRefreshBackStateFooter.h │ │ │ │ │ └── MJRefreshBackStateFooter.m │ │ │ └── Header │ │ │ │ ├── MJRefreshGifHeader.h │ │ │ │ ├── MJRefreshGifHeader.m │ │ │ │ ├── MJRefreshNormalHeader.h │ │ │ │ ├── MJRefreshNormalHeader.m │ │ │ │ ├── MJRefreshStateHeader.h │ │ │ │ └── MJRefreshStateHeader.m │ │ ├── MJRefresh.bundle │ │ │ ├── arrow@2x.png │ │ │ ├── en.lproj │ │ │ │ └── Localizable.strings │ │ │ ├── zh-Hans.lproj │ │ │ │ └── Localizable.strings │ │ │ └── zh-Hant.lproj │ │ │ │ └── Localizable.strings │ │ ├── MJRefresh.h │ │ ├── MJRefreshConst.h │ │ ├── MJRefreshConst.m │ │ ├── NSBundle+MJRefresh.h │ │ ├── NSBundle+MJRefresh.m │ │ ├── UIScrollView+MJExtension.h │ │ ├── UIScrollView+MJExtension.m │ │ ├── UIScrollView+MJRefresh.h │ │ ├── UIScrollView+MJRefresh.m │ │ ├── UIView+MJExtension.h │ │ └── UIView+MJExtension.m │ └── README.md ├── Manifest.lock ├── Masonry │ ├── LICENSE │ ├── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASCompositeConstraint.m │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraint.m │ │ ├── MASConstraintMaker.h │ │ ├── MASConstraintMaker.m │ │ ├── MASLayoutConstraint.h │ │ ├── MASLayoutConstraint.m │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewAttribute.m │ │ ├── MASViewConstraint.h │ │ ├── MASViewConstraint.m │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASAdditions.m │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.m │ │ ├── View+MASAdditions.h │ │ ├── View+MASAdditions.m │ │ ├── View+MASShorthandAdditions.h │ │ ├── ViewController+MASAdditions.h │ │ └── ViewController+MASAdditions.m │ └── README.md ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── Abner.xcuserdatad │ │ └── xcschemes │ │ ├── UITableView+FDTemplateLayoutCell.xcscheme │ │ └── xcschememanagement.plist ├── Target Support Files │ ├── MJRefresh │ │ ├── MJRefresh-dummy.m │ │ ├── MJRefresh-prefix.pch │ │ └── MJRefresh.xcconfig │ ├── Masonry │ │ ├── Masonry-dummy.m │ │ ├── Masonry-prefix.pch │ │ └── Masonry.xcconfig │ ├── Pods-HDTableViewMakerDemo │ │ ├── Pods-HDTableViewMakerDemo-acknowledgements.markdown │ │ ├── Pods-HDTableViewMakerDemo-acknowledgements.plist │ │ ├── Pods-HDTableViewMakerDemo-dummy.m │ │ ├── Pods-HDTableViewMakerDemo-frameworks.sh │ │ ├── Pods-HDTableViewMakerDemo-resources.sh │ │ ├── Pods-HDTableViewMakerDemo.debug.xcconfig │ │ └── Pods-HDTableViewMakerDemo.release.xcconfig │ └── UITableView+FDTemplateLayoutCell │ │ ├── UITableView+FDTemplateLayoutCell-dummy.m │ │ ├── UITableView+FDTemplateLayoutCell-prefix.pch │ │ └── UITableView+FDTemplateLayoutCell.xcconfig └── UITableView+FDTemplateLayoutCell │ ├── Classes │ ├── UITableView+FDIndexPathHeightCache.h │ ├── UITableView+FDIndexPathHeightCache.m │ ├── UITableView+FDKeyedHeightCache.h │ ├── UITableView+FDKeyedHeightCache.m │ ├── UITableView+FDTemplateLayoutCell.h │ ├── UITableView+FDTemplateLayoutCell.m │ ├── UITableView+FDTemplateLayoutCellDebug.h │ └── UITableView+FDTemplateLayoutCellDebug.m │ ├── LICENSE │ └── README.md ├── README.md ├── openSource.jpg └── pod trunk register fjhongdong@126.com 'AbnerH' -- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /HDTableViewMaker.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "HDTableViewMaker" 3 | s.version = "1.0.9" 4 | s.summary = '只需一行代码,通过链式风格快速配置UITableView包括创建Delegate和DataSource、添加下拉刷新等各种功能,满足你对UITableView的一切幻想' 5 | s.homepage = "https://github.com/hongdong/HDTableViewMaker" 6 | s.license = 'MIT' 7 | s.author = { "Abner" => "fjhongdong@126.com" } 8 | s.source = { :git => 'https://github.com/hongdong/HDTableViewMaker.git', :tag => "1.0.9" } 9 | s.platform = :ios, "7.0" 10 | s.source_files = "HDTableViewMaker/*.{h,m}" 11 | s.resource = 'HDTableViewMaker/HDTableViewMaker.bundle' 12 | # s.framework = 'QuartzCore' 13 | s.requires_arc = true 14 | s.dependency 'MJRefresh' 15 | s.dependency 'UITableView+FDTemplateLayoutCell' 16 | s.dependency 'Masonry' 17 | 18 | end 19 | 20 | #pod spec lint --allow-warnings --use-libraries 校验命令 21 | #pod trunk push HDTableViewMaker.podspec --allow-warnings --use-libraries 上传命令 -------------------------------------------------------------------------------- /HDTableViewMaker/HDBaseTableViewDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDBaseTableViewDataSource.h 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @class HDSectionData,HDTableData; 13 | 14 | @protocol HDBaseTableViewDataSourceProtocol 15 | @property (nonatomic, strong) HDTableData *tableData; 16 | @end 17 | 18 | 19 | @interface HDBaseTableViewDataSource : NSObject 20 | 21 | @property (nonatomic, strong) HDTableData *tableData; 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDBaseTableViewDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDBaseTableViewDataSource.m 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import "HDBaseTableViewDataSource.h" 10 | #import 11 | #import "HDSectionData.h" 12 | #import "HDTableData.h" 13 | #import "UITableView+FDTemplateLayoutCell.h" 14 | #import "HDCellData.h" 15 | 16 | @implementation HDBaseTableViewDataSource 17 | 18 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 19 | return self.tableData.sectionCount; 20 | } 21 | 22 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 23 | if (self.tableData.sectionDatas[(NSUInteger) section].rowCount==0) { 24 | return self.tableData.sectionDatas[(NSUInteger) section].modelDatas.count; 25 | } 26 | return self.tableData.sectionDatas[(NSUInteger) section].rowCount; 27 | } 28 | 29 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 30 | return self.tableData.sectionDatas[(NSUInteger) section].headerTitle; 31 | } 32 | 33 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { 34 | return self.tableData.sectionDatas[(NSUInteger) section].footerTitle; 35 | } 36 | 37 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 38 | return self.tableData.sectionDatas[(NSUInteger) section].headerView; 39 | } 40 | 41 | 42 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 43 | return self.tableData.sectionDatas[(NSUInteger) section].footerView; 44 | } 45 | 46 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 47 | return self.tableData.sectionDatas[(NSUInteger) section].headerHeight; 48 | } 49 | 50 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 51 | return self.tableData.sectionDatas[(NSUInteger) section].footerHeight; 52 | } 53 | 54 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 55 | NSUInteger section = (NSUInteger) indexPath.section; 56 | NSUInteger index = (NSUInteger) indexPath.row; 57 | 58 | HDSectionData *sectionData = self.tableData.sectionDatas[section]; 59 | 60 | HDCellData *cellData = sectionData.cellDatas[index]; 61 | 62 | return cellData.rowHeight; 63 | 64 | } 65 | 66 | 67 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 68 | NSUInteger section = (NSUInteger) indexPath.section; 69 | NSUInteger index = (NSUInteger) indexPath.row; 70 | 71 | HDCellData *cellData = self.tableData.sectionDatas[section].cellDatas[index]; 72 | 73 | return [cellData getReturnCell]; 74 | } 75 | 76 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 77 | NSUInteger section = (NSUInteger) indexPath.section; 78 | NSUInteger index = (NSUInteger) indexPath.row; 79 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 80 | HDCellData *cellData = self.tableData.sectionDatas[section].cellDatas[index]; 81 | 82 | if (cellData.event) { 83 | cellData.event(tableView,indexPath,cellData.data); 84 | } 85 | 86 | } 87 | 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDCellData.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDCellData.h 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | typedef NS_ENUM(NSInteger, HDCellRegisterType) { 13 | HDCellRegisterTypeClass = 0, 14 | HDCellRegisterTypeXib = 1, 15 | }; 16 | 17 | typedef CGFloat (^RowHeightBlock)(NSIndexPath *indexPath); 18 | typedef void (^CellAdapterBlock)(__kindof UITableViewCell *cell,id data,NSIndexPath *indexPath); 19 | typedef void (^CellEventBlock)(UITableView *tableView, NSIndexPath *indexPath,id data); 20 | 21 | @interface HDCellData : NSObject 22 | 23 | @property(nonatomic, weak) UITableView * tableView; 24 | 25 | 26 | @property (nonatomic, assign) id data; 27 | 28 | @property (nonatomic, copy) RowHeightBlock rowHeightBlock; 29 | 30 | @property (nonatomic, assign) CGFloat rowHeight; 31 | 32 | @property (nonatomic, assign) HDCellRegisterType cellRegisterType; 33 | 34 | @property(nonatomic, strong) Class cell; 35 | @property (nonatomic, strong) NSString *cellIdentifier; 36 | @property(nonatomic, copy) CellAdapterBlock adapter; 37 | @property(nonatomic, copy) CellEventBlock event; 38 | 39 | @property (nonatomic, strong) NSIndexPath *indexPath; 40 | 41 | @property(nonatomic, assign) BOOL isAutoHeight; 42 | 43 | -(UITableViewCell *)getReturnCell; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDCellData.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDCellData.m 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import "HDCellData.h" 10 | #import "UITableView+FDTemplateLayoutCell.h" 11 | #import "UITableViewCell+HDTableViewMaker.h" 12 | #import "UITableView+HDTableViewMaker.h" 13 | 14 | @implementation HDCellData 15 | 16 | -(UITableViewCell *)getReturnCell{ 17 | UITableViewCell * cell = [self.tableView dequeueReusableCellWithIdentifier:self.cellIdentifier forIndexPath:self.indexPath]; 18 | //NSLog(@"adaptBlock %@", [adaptBlock isEqual:nil]); 19 | cell.tableView = self.tableView; 20 | cell.indexPath = self.indexPath; 21 | if(_adapter) { 22 | _adapter(cell,_data,_indexPath); 23 | } 24 | return cell; 25 | } 26 | /** 27 | * GET\SET 28 | * 29 | */ 30 | -(NSString *)cellIdentifier{ 31 | if (!_cellIdentifier) { 32 | _cellIdentifier = NSStringFromClass(_cell); 33 | } 34 | return _cellIdentifier; 35 | } 36 | 37 | -(void)setCell:(Class)cell{ 38 | _cell = cell; 39 | if (!self.tableView.tableViewRegisterCell[self.cellIdentifier]) {//如果没有注册过 40 | UINib *nib = [UINib nibWithNibName:self.cellIdentifier bundle:nil]; 41 | if (self.cellRegisterType==HDCellRegisterTypeClass) { 42 | [self.tableView registerClass:[cell class] forCellReuseIdentifier:self.cellIdentifier]; 43 | }else{ 44 | [self.tableView registerNib:nib forCellReuseIdentifier:self.cellIdentifier]; 45 | } 46 | 47 | [self.tableView.tableViewRegisterCell setValue:@(YES) forKey:self.cellIdentifier]; 48 | } 49 | } 50 | 51 | -(CGFloat)rowHeight{ 52 | if (self.isAutoHeight) { 53 | _rowHeight = [self.tableView fd_heightForCellWithIdentifier:self.cellIdentifier cacheByIndexPath:_indexPath configuration:^(id cell) { 54 | if (self.adapter) { 55 | self.adapter(cell,self.data,self.indexPath); 56 | } 57 | }]; 58 | } 59 | return _rowHeight; 60 | } 61 | @end 62 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDCellMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDCellMaker.h 3 | // 4 | // Created by 洪东 on 7/15/16. 5 | // Copyright © 2016 Cocbin. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | #import "HDCellData.h" 11 | @class HDCellData; 12 | @interface HDCellMaker : NSObject 13 | 14 | - (instancetype)initWithTableView:(UITableView *)tableView; 15 | 16 | 17 | @property (nonatomic, strong) HDCellData *cellData; 18 | 19 | - (NSIndexPath *) indexPath; 20 | 21 | - (HDCellMaker * (^)(CGFloat)) hd_rowHeight; 22 | 23 | - (HDCellMaker * (^)())hd_autoHeight; 24 | 25 | - (HDCellMaker * (^)(Class))hd_cellClass; 26 | 27 | - (HDCellMaker * (^)(Class))hd_cellClassXib; 28 | 29 | - (HDCellMaker * (^)(id))hd_data; 30 | 31 | - (HDCellMaker * (^)(CellAdapterBlock))hd_adapter; 32 | 33 | - (HDCellMaker * (^)(CellEventBlock))hd_event; 34 | 35 | - (HDCellMaker * (^)(Class,CellAdapterBlock))hd_cellClassAndAdapter; 36 | 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDCellMaker.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDCellMaker.m 3 | // 4 | // Created by 洪东 on 7/15/16. 5 | // Copyright © 2016 Cocbin. All rights reserved. 6 | // 7 | 8 | #import "HDCellMaker.h" 9 | #import "HDCellData.h" 10 | 11 | @implementation HDCellMaker 12 | 13 | - (instancetype)initWithTableView:(UITableView *)tableView{ 14 | self = [super init]; 15 | if (self) { 16 | self.cellData.tableView = tableView; 17 | } 18 | return self; 19 | 20 | } 21 | 22 | - (NSIndexPath *)indexPath{ 23 | return self.cellData.indexPath; 24 | } 25 | 26 | - (HDCellMaker * (^)())hd_autoHeight { 27 | return ^HDCellMaker * { 28 | self.cellData.isAutoHeight = YES; 29 | return self; 30 | }; 31 | } 32 | 33 | - (HDCellMaker * (^)(CGFloat))hd_rowHeight{ 34 | return ^HDCellMaker *(CGFloat height){ 35 | self.cellData.rowHeight = height; 36 | return self; 37 | }; 38 | } 39 | 40 | - (HDCellMaker * (^)(Class))hd_cellClass { 41 | return ^HDCellMaker *(Class cell) { 42 | self.cellData.cellRegisterType = HDCellRegisterTypeClass; 43 | self.cellData.cell = cell; 44 | return self; 45 | }; 46 | } 47 | 48 | - (HDCellMaker * (^)(Class))hd_cellClassXib { 49 | return ^HDCellMaker *(Class cell) { 50 | self.cellData.cellRegisterType = HDCellRegisterTypeXib; 51 | self.cellData.cell = cell; 52 | return self; 53 | }; 54 | } 55 | 56 | - (HDCellMaker * (^)(id))hd_data { 57 | return ^HDCellMaker *(id data) { 58 | self.cellData.data = data; 59 | return self; 60 | }; 61 | } 62 | 63 | - (HDCellMaker * (^)(CellAdapterBlock))hd_adapter { 64 | return ^HDCellMaker *(CellAdapterBlock adapterBlock) { 65 | self.cellData.adapter = adapterBlock; 66 | return self; 67 | }; 68 | } 69 | 70 | - (HDCellMaker * (^)(Class,CellAdapterBlock))hd_cellClassAndAdapter{ 71 | return ^HDCellMaker *(Class cell,CellAdapterBlock adapterBlock) { 72 | self.cellData.cell = cell; 73 | self.cellData.adapter = adapterBlock; 74 | return self; 75 | }; 76 | } 77 | - (HDCellMaker * (^)(CellEventBlock))hd_event { 78 | return ^HDCellMaker *(CellEventBlock event) { 79 | self.cellData.event = event; 80 | return self; 81 | }; 82 | } 83 | 84 | 85 | 86 | 87 | /** 88 | * GET 89 | */ 90 | - (HDCellData *)cellData 91 | { 92 | if (!_cellData) { 93 | _cellData = [HDCellData new]; 94 | } 95 | return _cellData; 96 | } 97 | 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDSectionData.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDSectionData.h 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "HDCellMaker.h" 12 | 13 | typedef NSArray * (^GetDataBlock)(); 14 | 15 | typedef NSInteger (^NumberOfRowsBlock)(NSInteger section); 16 | typedef void (^CellMakeBlock)(HDCellMaker * cellMaker); 17 | 18 | @interface HDSectionData : NSObject 19 | 20 | @property(nonatomic, assign) BOOL isStaticCell; 21 | 22 | @property(nonatomic, strong) NSMutableArray * cellDatas; 23 | 24 | @property(nonatomic, weak) UITableView * tableView; 25 | 26 | @property (nonatomic, strong) NSArray *modelDatas; 27 | 28 | @property(nonatomic, strong) NSString * headerTitle; 29 | @property(nonatomic, strong) NSString * footerTitle; 30 | @property (nonatomic, assign) CGFloat headerHeight; 31 | @property (nonatomic, assign) CGFloat footerHeight; 32 | 33 | @property(nonatomic, strong) UIView * headerView; 34 | @property(nonatomic, strong) UIView * footerView; 35 | 36 | @property(nonatomic, assign) CGFloat rowHeight; 37 | 38 | 39 | @property (nonatomic, assign) NSUInteger section; 40 | 41 | @property (nonatomic, assign) NSUInteger rowCount; 42 | 43 | 44 | 45 | @property(nonatomic, copy) NumberOfRowsBlock numberOfRowsBlock; 46 | 47 | @property(nonatomic, copy) CellMakeBlock cellMakeBlock; 48 | 49 | @property(nonatomic, copy) GetDataBlock getDataBlock; 50 | 51 | - (void) doCellMakerBlock; 52 | 53 | - (void) doAddCellMakerBlock:(CellMakeBlock)cellMakerBlock; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDSectionData.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDSectionData.m 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import "HDSectionData.h" 10 | 11 | @implementation HDSectionData 12 | 13 | @synthesize rowCount = _rowCount; 14 | 15 | /** 16 | * GET 17 | */ 18 | 19 | -(CGFloat)headerHeight{ 20 | if (_headerHeight==0) { 21 | _headerHeight = 0.0001; 22 | if (self.headerView) { 23 | _headerHeight = _headerView.frame.size.height; 24 | } 25 | if (self.headerTitle) { 26 | _headerHeight = 30; 27 | } 28 | } 29 | return _headerHeight; 30 | } 31 | 32 | -(CGFloat)footerHeight{ 33 | if (_footerHeight==0) { 34 | _footerHeight = 0.0001; 35 | if (self.footerView) { 36 | _headerHeight = _footerView.frame.size.height; 37 | } 38 | if (self.footerTitle) { 39 | _headerHeight = 30; 40 | } 41 | } 42 | 43 | return _footerHeight; 44 | } 45 | 46 | -(NSUInteger)rowCount{ 47 | // if (_rowCount==0) { 48 | // _rowCount = self.modelDatas.count; 49 | // } 50 | return _rowCount; 51 | } 52 | 53 | -(void)setRowCount:(NSUInteger)rowCount{ 54 | _rowCount = rowCount; 55 | } 56 | 57 | -(void)setCellMakeBlock:(CellMakeBlock)cellMakeBlock{ 58 | _cellMakeBlock = cellMakeBlock; 59 | } 60 | 61 | -(void)doCellMakerBlock{ 62 | if ((self.rowCount>0||self.modelDatas.count>0)&&self.cellMakeBlock) { 63 | [_cellDatas removeAllObjects]; 64 | HDCellMaker * cellMaker = nil; 65 | NSUInteger count = self.modelDatas.count>0?self.modelDatas.count:self.rowCount; 66 | for (NSUInteger i = 0; i < count; i++) { 67 | cellMaker = [[HDCellMaker alloc] initWithTableView:self.tableView]; 68 | cellMaker.cellData.indexPath = [NSIndexPath indexPathForRow:i inSection:self.section]; 69 | cellMaker.cellData.data = self.modelDatas[i]; 70 | cellMaker.cellData.rowHeight = self.rowHeight; 71 | self.cellMakeBlock(cellMaker); 72 | [self.cellDatas addObject:cellMaker.cellData]; 73 | } 74 | } 75 | 76 | } 77 | 78 | - (void) doAddCellMakerBlock:(CellMakeBlock)cellMakerBlock{ 79 | if (!self.isStaticCell) { 80 | self.isStaticCell = YES; 81 | } 82 | HDCellMaker * cellMaker = nil; 83 | cellMaker = [[HDCellMaker alloc] initWithTableView:self.tableView]; 84 | cellMaker.cellData.indexPath = [NSIndexPath indexPathForRow:self.rowCount inSection:self.section]; 85 | self.rowCount = self.rowCount + 1; 86 | cellMaker.cellData.rowHeight = self.rowHeight; 87 | cellMakerBlock(cellMaker); 88 | [self.cellDatas addObject:cellMaker.cellData]; 89 | 90 | } 91 | 92 | -(NSArray *)modelDatas{ 93 | if (self.getDataBlock) { 94 | _modelDatas = self.getDataBlock(); 95 | } 96 | return _modelDatas; 97 | } 98 | 99 | -(NSMutableArray *)cellDatas{ 100 | if (!_cellDatas) { 101 | _cellDatas = [NSMutableArray array]; 102 | } 103 | return _cellDatas; 104 | } 105 | @end 106 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDSectionMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDSectionMaker.h 3 | // 4 | // Created by 洪东 on 7/15/16. 5 | // Copyright © 2016 Cocbin. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | #import "HDSectionData.h" 11 | #pragma mark -- Class HDSectionMaker 12 | @class HDTableCellMaker; 13 | @interface HDSectionMaker : NSObject 14 | 15 | - (instancetype)initWithTableView:(UITableView *)tableView; 16 | 17 | - (HDSectionMaker * (^)(GetDataBlock))hd_dataArr; 18 | 19 | - (NSUInteger) section; 20 | 21 | 22 | - (HDSectionMaker * (^)(NSString *))hd_headerTitle; 23 | - (HDSectionMaker * (^)(NSString *))hd_footerTitle; 24 | 25 | - (HDSectionMaker * (^)(UIView * (^)()))hd_headerView; 26 | - (HDSectionMaker * (^)(UIView * (^)()))hd_footerView; 27 | 28 | - (HDSectionMaker * (^)(CGFloat)) hd_rowHeight; 29 | 30 | - (HDSectionMaker * (^)(CGFloat)) hd_headerHeight; 31 | - (HDSectionMaker * (^)(CGFloat)) hd_footerHeight; 32 | 33 | 34 | 35 | - (HDSectionMaker * (^)(NSInteger))hd_rowCount; 36 | 37 | 38 | - (HDSectionMaker * (^)(CellMakeBlock))hd_cellMaker; 39 | 40 | - (HDSectionMaker * (^)(CellMakeBlock))hd_addCellMaker; 41 | 42 | - (HDSectionMaker *)hd_cellMaker:(CellMakeBlock)cellMakerBlock; 43 | 44 | - (HDSectionMaker *)hd_addCellMaker:(CellMakeBlock)cellMakerBlock; 45 | 46 | @property(nonatomic, strong) HDSectionData * sectionData; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDSectionMaker.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDSectionMaker.m 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import "HDSectionMaker.h" 10 | #import "HDSectionData.h" 11 | #import "HDCellMaker.h" 12 | 13 | @implementation HDSectionMaker 14 | 15 | - (instancetype)initWithTableView:(UITableView *)tableView{ 16 | self = [super init]; 17 | if (self) { 18 | self.sectionData.tableView = tableView; 19 | } 20 | return self; 21 | 22 | } 23 | 24 | //- (HDSectionMaker * (^)(NSArray *))data { 25 | // return ^HDSectionMaker *(NSArray * datas) { 26 | // self.sectionData.modelDatas = datas; 27 | // return self; 28 | // }; 29 | //} 30 | 31 | - (NSUInteger) section{ 32 | return self.sectionData.section; 33 | } 34 | 35 | - (HDSectionMaker * (^)(NSString *))hd_headerTitle { 36 | return ^HDSectionMaker *(NSString * title) { 37 | self.sectionData.headerTitle = title; 38 | return self; 39 | }; 40 | } 41 | 42 | - (HDSectionMaker * (^)(NSString *))hd_footerTitle { 43 | return ^HDSectionMaker *(NSString * title) { 44 | self.sectionData.footerTitle = title; 45 | return self; 46 | }; 47 | } 48 | 49 | - (HDSectionMaker * (^)(CGFloat))hd_rowHeight{ 50 | return ^HDSectionMaker *(CGFloat height){ 51 | self.sectionData.rowHeight = height; 52 | return self; 53 | }; 54 | } 55 | 56 | - (HDSectionMaker * (^)(CGFloat))hd_headerHeight{ 57 | return ^HDSectionMaker *(CGFloat height){ 58 | self.sectionData.headerHeight = height; 59 | return self; 60 | }; 61 | } 62 | 63 | - (HDSectionMaker * (^)(CGFloat))hd_footerHeight{ 64 | return ^HDSectionMaker *(CGFloat height){ 65 | self.sectionData.footerHeight = height; 66 | return self; 67 | }; 68 | } 69 | 70 | 71 | - (HDSectionMaker * (^)(UIView * (^)()))hd_headerView { 72 | return ^HDSectionMaker *(UIView * (^view)()) { 73 | self.sectionData.headerView = view(); 74 | return self; 75 | }; 76 | } 77 | 78 | - (HDSectionMaker * (^)(GetDataBlock))hd_dataArr{ 79 | return ^HDSectionMaker *(GetDataBlock getDataBlock){ 80 | self.sectionData.getDataBlock = getDataBlock; 81 | return self; 82 | }; 83 | } 84 | 85 | - (HDSectionMaker * (^)(UIView * (^)()))hd_footerView { 86 | return ^HDSectionMaker *(UIView * (^view)()) { 87 | self.sectionData.footerView = view(); 88 | return self; 89 | }; 90 | } 91 | 92 | - (HDSectionMaker * (^)(NSInteger))hd_rowCount{ 93 | return ^HDSectionMaker *(NSInteger rowCount){ 94 | self.sectionData.rowCount = rowCount; 95 | return self; 96 | }; 97 | } 98 | 99 | - (HDSectionMaker * (^)(CellMakeBlock))hd_cellMaker{ 100 | return ^HDSectionMaker *(CellMakeBlock cellMakerBlock){ 101 | self.sectionData.cellMakeBlock = cellMakerBlock; 102 | return self; 103 | }; 104 | } 105 | - (HDSectionMaker * (^)(CellMakeBlock))hd_addCellMaker{ 106 | return ^HDSectionMaker *(CellMakeBlock cellMakerBlock){ 107 | [self.sectionData doAddCellMakerBlock:cellMakerBlock]; 108 | return self; 109 | }; 110 | } 111 | - (HDSectionMaker *)hd_cellMaker:(CellMakeBlock)cellMakerBlock{ 112 | self.sectionData.cellMakeBlock = cellMakerBlock; 113 | return self; 114 | } 115 | 116 | - (HDSectionMaker *)hd_addCellMaker:(CellMakeBlock)cellMakerBlock{ 117 | [self.sectionData doAddCellMakerBlock:cellMakerBlock]; 118 | return self; 119 | } 120 | 121 | /** 122 | * GET 123 | */ 124 | - (HDSectionData *)sectionData { 125 | if (! _sectionData) { 126 | _sectionData = [HDSectionData new]; 127 | } 128 | return _sectionData; 129 | } 130 | 131 | @end 132 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDTMCommonHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTMCommonHeader.h 3 | // HDTableViewMakerDemo 4 | // 5 | // Created by Abner on 16/8/13. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #ifndef HDTMCommonHeader_h 10 | #define HDTMCommonHeader_h 11 | 12 | typedef void(^HDTMVoidBlock)(); 13 | 14 | //Weak 15 | #define HDWeak(var, weakVar) __weak __typeof(&*var) weakVar = var 16 | #define HDStrong_DoNotCheckNil(weakVar, _var) __typeof(&*weakVar) _var = weakVar 17 | #define HDStrong(weakVar, _var) HDStrong_DoNotCheckNil(weakVar, _var); if (!_var) return; 18 | 19 | #define HDWeak_(var) HDWeak(var, weak_##var); 20 | #define HDStrong_(var) HDStrong(weak_##var, _##var); 21 | 22 | /** defines a weak `self` named `__weakSelf` */ 23 | #define HDWeakSelf HDWeak(self, __weakSelf); 24 | /** defines a strong `self` named `_self` from `__weakSelf` */ 25 | #define HDStrongSelf HDStrong(__weakSelf, _self); 26 | 27 | 28 | #endif /* HDTMCommonHeader_h */ 29 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDTableData.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableData.h 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | @class HDSectionData,HDSectionMaker; 12 | 13 | typedef void (^CellWillDisplayBlock)(UITableView *tableView,UITableViewCell *willDisplayCell,NSIndexPath *indexPath); 14 | 15 | typedef void (^CommitEditingBlock)(UITableView * tableView,UITableViewCellEditingStyle editingStyle,NSIndexPath * indexPath); 16 | 17 | typedef void (^ScrollViewDidScrollBlock)(UIScrollView *scrollView); 18 | 19 | typedef void (^SectionMakeBlock)(HDSectionMaker * sectionMaker); 20 | 21 | typedef NSUInteger (^SectionCountBlock)(UITableView *tableView); 22 | 23 | @interface HDTableData : NSObject 24 | 25 | -(instancetype) initWithTableView:(UITableView *)tableView; 26 | 27 | - (void) doAddSectionMaker:(SectionMakeBlock)sectionMakerBlock; 28 | 29 | - (void) doSectionMakeBlock; 30 | 31 | @property(nonatomic, weak) UITableView * tableView; 32 | 33 | @property(nonatomic, strong) NSMutableArray * sectionDatas; 34 | 35 | @property (nonatomic, assign) NSUInteger sectionCount; 36 | 37 | @property (nonatomic, strong) NSArray *dataArr; 38 | 39 | @property (nonatomic, assign) CGFloat rowHeight; 40 | 41 | @property (nonatomic, copy) SectionMakeBlock sectionMakeBlock; 42 | 43 | @property (nonatomic, copy) SectionCountBlock sectionCountBlock; 44 | 45 | @property(nonatomic, strong) NSMutableDictionary * otherDelegateBlocksDic; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDTableData.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableData.m 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import "HDTableData.h" 10 | #import "HDSectionMaker.h" 11 | 12 | @implementation HDTableData 13 | @synthesize sectionCount = _sectionCount; 14 | -(instancetype)initWithTableView:(UITableView *)tableView{ 15 | self = [super init]; 16 | if (self) { 17 | self.tableView = tableView; 18 | } 19 | return self; 20 | } 21 | 22 | /** 23 | * GET 24 | */ 25 | 26 | -(NSUInteger)sectionCount{ 27 | 28 | if (self.sectionCountBlock) { 29 | [self setSectionCount:self.sectionCountBlock(self.tableView)]; 30 | } 31 | 32 | if (0==_sectionCount&&self.sectionDatas.count>0) { 33 | [self setSectionCount:self.sectionDatas.count]; 34 | } 35 | 36 | return _sectionCount; 37 | } 38 | 39 | -(void)setSectionCount:(NSUInteger)sectionCount{ 40 | _sectionCount = sectionCount; 41 | } 42 | 43 | -(NSMutableArray *)sectionDatas{ 44 | if (!_sectionDatas) { 45 | _sectionDatas = [NSMutableArray array]; 46 | } 47 | return _sectionDatas; 48 | } 49 | 50 | -(void)setSectionMakeBlock:(SectionMakeBlock)sectionMakeBlock{ 51 | _sectionMakeBlock = sectionMakeBlock; 52 | } 53 | 54 | -(void)doSectionMakeBlock{ 55 | if (self.sectionCount>0&&self.sectionMakeBlock) { 56 | [_sectionDatas removeAllObjects]; 57 | HDSectionMaker * sectionMaker = nil; 58 | for (NSUInteger i = 0; i 9 | #import 10 | #import "HDTableData.h" 11 | #pragma mark -- Class HDTableViewMaker 12 | @class HDTableSectionMaker; 13 | @interface HDTableViewMaker : NSObject 14 | 15 | @property (nonatomic, strong) HDTableData *tableData; 16 | 17 | - (instancetype)initWithTableView:(UITableView *)tableView; 18 | 19 | - (instancetype)initWithTableData:(HDTableData *)tableData; 20 | 21 | 22 | - (HDTableViewMaker * (^)(CGFloat))hd_height; 23 | 24 | - (HDTableViewMaker * (^)(UIView * (^)()))hd_tableViewHeaderView; 25 | 26 | - (HDTableViewMaker * (^)(UIView * (^)()))hd_tableViewFooterView; 27 | 28 | - (HDTableViewMaker * (^)(NSInteger))hd_sectionCount; 29 | 30 | - (HDTableViewMaker * (^)(SectionCountBlock))hd_sectionCountBk; 31 | 32 | - (HDTableViewMaker * (^)(SectionMakeBlock))hd_sectionMaker; 33 | 34 | - (HDTableViewMaker *) hd_sectionMaker:(SectionMakeBlock)sectionMakeBlock; 35 | 36 | - (HDTableViewMaker * (^)(SectionMakeBlock))hd_addSectionMaker; 37 | 38 | - (HDTableViewMaker *) hd_addSectionMaker:(SectionMakeBlock)sectionMakeBlock; 39 | 40 | - (HDTableViewMaker * (^)(CellWillDisplayBlock))hd_cellWillDisplay; 41 | 42 | - (HDTableViewMaker * (^)(CommitEditingBlock))hd_commitEditing; 43 | 44 | - (HDTableViewMaker * (^)(ScrollViewDidScrollBlock))hd_scrollViewDidScroll; 45 | 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDTableViewMaker.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewMaker.m 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import "HDTableViewMaker.h" 10 | #import "HDTableData.h" 11 | #import "HDSectionMaker.h" 12 | #import "HDSectionData.h" 13 | 14 | #define HDStringSelector(_SEL_) NSStringFromSelector(@selector(_SEL_)) 15 | 16 | 17 | @interface HDTableViewMaker () 18 | 19 | @end 20 | 21 | @implementation HDTableViewMaker 22 | 23 | - (instancetype)initWithTableView:(UITableView *)tableView{ 24 | self = [super init]; 25 | if (self) { 26 | self.tableData.tableView = tableView; 27 | } 28 | return self; 29 | 30 | } 31 | - (instancetype)initWithTableData:(HDTableData *)tableData{ 32 | self = [super init]; 33 | if (self) { 34 | self.tableData = tableData; 35 | } 36 | return self; 37 | 38 | } 39 | 40 | - (HDTableViewMaker * (^)(UIView * (^)()))hd_tableViewHeaderView { 41 | return ^HDTableViewMaker *(UIView * (^view)()) { 42 | UIView * headerView = view(); 43 | [self.tableData.tableView.tableHeaderView layoutIfNeeded]; 44 | self.tableData.tableView.tableHeaderView = headerView; 45 | return self; 46 | }; 47 | } 48 | 49 | - (HDTableViewMaker * (^)(UIView * (^)()))hd_tableViewFooterView { 50 | return ^HDTableViewMaker *(UIView * (^view)()) { 51 | UIView * footerView = view(); 52 | [self.tableData.tableView.tableFooterView layoutIfNeeded]; 53 | self.tableData.tableView.tableFooterView = footerView; 54 | return self; 55 | }; 56 | } 57 | 58 | - (HDTableViewMaker * (^)(CGFloat))hd_height { 59 | return ^HDTableViewMaker *(CGFloat height) { 60 | self.tableData.rowHeight = height; 61 | self.tableData.tableView.rowHeight = height; 62 | return self; 63 | }; 64 | } 65 | 66 | - (HDTableViewMaker * (^)(NSInteger))hd_sectionCount { 67 | return ^HDTableViewMaker *(NSInteger sectionCount) { 68 | self.tableData.sectionCount = sectionCount; 69 | return self; 70 | }; 71 | } 72 | 73 | - (HDTableViewMaker * (^)(SectionCountBlock))hd_sectionCountBk{ 74 | return ^HDTableViewMaker *(SectionCountBlock sectionCountBlock){ 75 | self.tableData.sectionCountBlock = sectionCountBlock; 76 | return self; 77 | }; 78 | } 79 | 80 | - (HDTableViewMaker * (^)(SectionMakeBlock))hd_sectionMaker{ 81 | return ^HDTableViewMaker *(SectionMakeBlock sectionMakeBlock){ 82 | self.tableData.sectionMakeBlock = sectionMakeBlock; 83 | return self; 84 | }; 85 | } 86 | 87 | - (HDTableViewMaker * (^)(SectionMakeBlock))hd_addSectionMaker{ 88 | return ^HDTableViewMaker *(SectionMakeBlock sectionMakeBlock){ 89 | [self.tableData doAddSectionMaker:sectionMakeBlock]; 90 | return self; 91 | }; 92 | } 93 | 94 | - (HDTableViewMaker *) hd_sectionMaker:(SectionMakeBlock)sectionMakeBlock{ 95 | self.tableData.sectionMakeBlock = sectionMakeBlock; 96 | return self; 97 | } 98 | 99 | - (HDTableViewMaker *) hd_addSectionMaker:(SectionMakeBlock)sectionMakeBlock{ 100 | [self.tableData doAddSectionMaker:sectionMakeBlock]; 101 | return self; 102 | } 103 | 104 | 105 | - (HDTableViewMaker * (^)(CellWillDisplayBlock))hd_cellWillDisplay{ 106 | return ^HDTableViewMaker *(CellWillDisplayBlock cellWillDisplayBlock){ 107 | // self.tableData.cellWillDisplayBlock = cellWillDisplayBlock; 108 | self.tableData.otherDelegateBlocksDic[HDStringSelector(tableView:willDisplayCell:forRowAtIndexPath:)] = cellWillDisplayBlock; 109 | return self; 110 | }; 111 | } 112 | 113 | - (HDTableViewMaker * (^)(CommitEditingBlock))hd_commitEditing{ 114 | return ^HDTableViewMaker *(CommitEditingBlock commitEditingBlock){ 115 | self.tableData.otherDelegateBlocksDic[HDStringSelector(tableView:commitEditingStyle:forRowAtIndexPath:)] = commitEditingBlock; 116 | return self; 117 | }; 118 | } 119 | 120 | - (HDTableViewMaker * (^)(ScrollViewDidScrollBlock))hd_scrollViewDidScroll{ 121 | return ^HDTableViewMaker *(ScrollViewDidScrollBlock scrollViewDidScrollBlock){ 122 | self.tableData.otherDelegateBlocksDic[HDStringSelector(scrollViewDidScroll:)] = scrollViewDidScrollBlock; 123 | return self; 124 | }; 125 | } 126 | 127 | 128 | 129 | /** 130 | * GET 131 | */ 132 | - (HDTableData *)tableData 133 | { 134 | if (!_tableData) { 135 | _tableData = [HDTableData new]; 136 | } 137 | return _tableData; 138 | } 139 | 140 | @end 141 | -------------------------------------------------------------------------------- /HDTableViewMaker/HDTableViewMakerHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | 4 | #ifndef HDTableViewMakerHeader_h 5 | #define HDTableViewMakerHeader_h 6 | 7 | #define HDTableViewMakerVersion 1.0.9 /*  版本号 */ 8 | 9 | #define HDDataArr(__dataArr__) ^(){return __dataArr__;} 10 | 11 | #define HDCellClass(_cellClass_) [_cellClass_ class] 12 | 13 | #define HDAdapter(_adapter_) \ 14 | ^(__kindof UITableViewCell *cell,id data,NSIndexPath *indexPath){ \ 15 | _adapter_ \ 16 | } 17 | 18 | #define HDEvent(_event_) \ 19 | ^(__kindof UITableView *tableView,NSIndexPath *indexPath,id data){ \ 20 | _event_ \ 21 | } 22 | 23 | #define HDSectionCount(_count_) \ 24 | ^NSUInteger(UITableView *tableView){ \ 25 | _count_ \ 26 | } 27 | 28 | #define HDAddSectionMaker(_maker_) \ 29 | tableMaker.hd_addSectionMaker(^(HDSectionMaker *sectionMaker) { \ 30 | _maker_ \ 31 | }) 32 | 33 | #define HDAddCellMaker(_maker_) \ 34 | sectionMaker.hd_addCellMaker(^(HDCellMaker *cellMaker) { \ 35 | _maker_ \ 36 | }) 37 | 38 | 39 | 40 | #import "UITableView+HDTableViewMaker.h" 41 | #import "HDTableViewMaker.h" 42 | #import "HDSectionMaker.h" 43 | #import "HDCellMaker.h" 44 | #import "HDBaseTableViewDataSource.h" 45 | #import "UITableView+HDFreshUI.h" 46 | #import "UITableViewCell+HDTableViewMaker.h" 47 | #import "UITableView+HDCover.h" 48 | 49 | #endif /* HDTableViewDataSource_h */ 50 | -------------------------------------------------------------------------------- /HDTableViewMaker/NSBundle+HDTableViewMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+HDTableViewMaker.h 3 | // HDTableViewMakerDemo 4 | // 5 | // Created by Abner on 16/8/14. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSBundle (HDTableViewMaker) 13 | + (instancetype)hd_tableViewMakerBundle; 14 | + (UIImage *)hd_emptyImage; 15 | + (UIImage *)hd_errorImage; 16 | @end 17 | -------------------------------------------------------------------------------- /HDTableViewMaker/NSBundle+HDTableViewMaker.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+HDTableViewMaker.m 3 | // HDTableViewMakerDemo 4 | // 5 | // Created by Abner on 16/8/14. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #import "NSBundle+HDTableViewMaker.h" 10 | 11 | @implementation NSBundle (HDTableViewMaker) 12 | + (instancetype)hd_tableViewMakerBundle 13 | { 14 | static NSBundle *tableViewMakerBundle = nil; 15 | if (tableViewMakerBundle == nil) { 16 | NSString * bundlePath = [[ NSBundle mainBundle] pathForResource:@"HDTableViewMaker" ofType :@"bundle"]; 17 | tableViewMakerBundle = [NSBundle bundleWithPath:bundlePath]; 18 | } 19 | return tableViewMakerBundle; 20 | } 21 | 22 | + (UIImage *)hd_emptyImage 23 | { 24 | static UIImage *arrowImage = nil; 25 | if (arrowImage == nil) { 26 | arrowImage = [[UIImage imageWithContentsOfFile:[[self hd_tableViewMakerBundle] pathForResource:@"hd_tm_empty_icon@2x" ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 27 | } 28 | return arrowImage; 29 | } 30 | + (UIImage *)hd_errorImage 31 | { 32 | static UIImage *arrowImage = nil; 33 | if (arrowImage == nil) { 34 | arrowImage = [[UIImage imageWithContentsOfFile:[[self hd_tableViewMakerBundle] pathForResource:@"hd_tm_error_icon@2x" ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 35 | } 36 | return arrowImage; 37 | } 38 | @end 39 | -------------------------------------------------------------------------------- /HDTableViewMaker/NSObject+HDAssociated.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+HDAssociated.h 3 | // HDTableViewMakerDemo 4 | // 5 | // Created by Abner on 16/8/4. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSObject (HDAssociated) 14 | - (nullable id)hd_getAssociatedObjectWithKey:(const void *)cKey; 15 | 16 | - (void)hd_setAssociatedAssignObject:(nullable id)cValue key:(const void *)cKey; 17 | 18 | - (void)hd_setAssociatedRetainObject:(nullable id)cValue key:(const void *)cKey; 19 | 20 | - (void)hd_setAssociatedCopyObject:(nullable id)cValue key:(const void *)cKey; 21 | 22 | - (void)hd_setAssociatedObject:(nullable id)cValue key:(const void *)cKey policy:(objc_AssociationPolicy)cPolicy; 23 | @end 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HDTableViewMaker/NSObject+HDAssociated.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+HDAssociated.m 3 | // HDTableViewMakerDemo 4 | // 5 | // Created by Abner on 16/8/4. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #import "NSObject+HDAssociated.h" 10 | 11 | @implementation NSObject (HDAssociated) 12 | - (id)hd_getAssociatedObjectWithKey:(const void *)cKey 13 | { 14 | return objc_getAssociatedObject(self, cKey); 15 | } 16 | 17 | - (void)hd_setAssociatedAssignObject:(id)cValue key:(const void *)cKey 18 | { 19 | objc_setAssociatedObject(self, cKey, cValue, OBJC_ASSOCIATION_ASSIGN); 20 | } 21 | 22 | - (void)hd_setAssociatedRetainObject:(id)cValue key:(const void *)cKey 23 | { 24 | objc_setAssociatedObject(self, cKey, cValue, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 25 | } 26 | 27 | - (void)hd_setAssociatedCopyObject:(id)cValue key:(const void *)cKey 28 | { 29 | objc_setAssociatedObject(self, cKey, cValue, OBJC_ASSOCIATION_COPY); 30 | } 31 | 32 | - (void)hd_setAssociatedObject:(id)cValue key:(const void *)cKey policy:(objc_AssociationPolicy)cPolicy 33 | { 34 | objc_setAssociatedObject(self, cKey, cValue, cPolicy); 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /HDTableViewMaker/UITableView+HDCover.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+HDCover.h 3 | // HDTableViewMakerDemo 4 | // 5 | // Created by 洪东 on 8/26/16. 6 | // Copyright © 2016 Abner. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HDTMCommonHeader.h" 11 | 12 | typedef NS_ENUM(NSInteger,HDTableViewCoverType) { 13 | HDTableViewCoverTypeNull = 0, 14 | HDTableViewCoverTypeEmpty = 1, 15 | HDTableViewCoverTypeError = 2, 16 | HDTableViewCoverTypeLoading = 3 17 | }; 18 | 19 | 20 | @interface UITableView (HDCover) 21 | 22 | @property (nonatomic, assign) HDTableViewCoverType hd_tableViewCoverType; 23 | 24 | @property (nonatomic, copy) HDTMVoidBlock hd_emptyBtnClickBlock; 25 | 26 | @property (nonatomic, copy) HDTMVoidBlock hd_errorBtnClickBlock; 27 | 28 | - (void) hd_coverLoading; 29 | 30 | - (void) hd_coverEmpty; 31 | 32 | - (void) hd_coverError; 33 | 34 | - (void) hd_coverDismiss; 35 | 36 | - (void) hd_coverEmpty:(HDTMVoidBlock)emptyBtnClickBlock; 37 | 38 | - (void) hd_coverError:(HDTMVoidBlock)errorBtnClickBlock; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /HDTableViewMaker/UITableView+HDFreshUI.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+HDFreshUI.h 3 | // wash4b 4 | // 5 | // Created by 洪东 on 7/18/16. 6 | // Copyright © 2016 abnerh. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MJRefresh.h" 11 | #import "HDTMCommonHeader.h" 12 | 13 | 14 | typedef NS_ENUM(NSInteger, HDFreshType) { 15 | HDFreshTypeFresh = 0, 16 | HDFreshTypeLoadMore = 1, 17 | }; 18 | 19 | typedef void (^FreshBlock)(HDFreshType freshType); 20 | 21 | 22 | @interface UITableView (HDFreshUI) 23 | 24 | -(UITableView *)hd_addFreshHeader:(HDTMVoidBlock)headerBlock; 25 | -(UITableView *)hd_addFreshFooter:(HDTMVoidBlock)footerBlock; 26 | -(UITableView *)hd_addAllFresh:(FreshBlock)freshBlock; 27 | 28 | -(void)hd_endFreshing:(BOOL)existMoreData; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /HDTableViewMaker/UITableView+HDFreshUI.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+HDFreshUI.m 3 | // wash4b 4 | // 5 | // Created by 洪东 on 7/18/16. 6 | // Copyright © 2016 abnerh. All rights reserved. 7 | // 8 | 9 | #import "UITableView+HDFreshUI.h" 10 | 11 | @implementation UITableView (HDFreshUI) 12 | 13 | -(UITableView *)hd_addFreshHeader:(HDTMVoidBlock)headerBlock{ 14 | if (headerBlock) { 15 | self.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ 16 | headerBlock(); 17 | }]; 18 | } 19 | return self; 20 | } 21 | -(UITableView *)hd_addFreshFooter:(HDTMVoidBlock)footerBlock{ 22 | if (footerBlock) { 23 | self.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{ 24 | footerBlock(); 25 | }]; 26 | [self.mj_footer setAutomaticallyHidden:YES]; 27 | } 28 | return self; 29 | } 30 | -(UITableView *)hd_addAllFresh:(FreshBlock)freshBlock{ 31 | 32 | [self hd_addFreshHeader:^{ 33 | freshBlock(HDFreshTypeFresh); 34 | }]; 35 | 36 | [self hd_addFreshFooter:^{ 37 | freshBlock(HDFreshTypeLoadMore); 38 | }]; 39 | return self; 40 | } 41 | 42 | -(void)hd_endFreshing:(BOOL)existMoreData{ 43 | 44 | if (self.mj_header.isRefreshing) { 45 | [self.mj_header endRefreshing]; 46 | } 47 | 48 | // if (self.mj_footer.isRefreshing) { 49 | // if (existMoreData) { 50 | // [self.mj_footer endRefreshing]; 51 | // }else{ 52 | // [self.mj_footer endRefreshingWithNoMoreData]; 53 | // } 54 | // } 55 | 56 | if (existMoreData) { 57 | [self.mj_footer resetNoMoreData]; 58 | }else{ 59 | [self.mj_footer endRefreshingWithNoMoreData]; 60 | } 61 | 62 | } 63 | @end 64 | -------------------------------------------------------------------------------- /HDTableViewMaker/UITableView+HDOperating.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+HD.m 3 | // CuteMommy 4 | // 5 | // Created by 洪小东 on 15/12/21. 6 | // Copyright © 2015年 CuteMommy. All rights reserved. 7 | // 8 | 9 | #import "UITableView+HDOperating.h" 10 | 11 | @implementation UITableView (HDOperating) 12 | 13 | 14 | - (void)updateWithBlock:(void (^)(UITableView *tableView))block { 15 | [self beginUpdates]; 16 | block(self); 17 | [self endUpdates]; 18 | } 19 | 20 | - (void)scrollToRow:(NSUInteger)row inSection:(NSUInteger)section atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated { 21 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; 22 | [self scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated]; 23 | } 24 | 25 | - (void)insertRowAtIndexPath:(NSIndexPath *)indexPath withRowAnimation:(UITableViewRowAnimation)animation { 26 | [self insertRowsAtIndexPaths:@[indexPath] withRowAnimation:animation]; 27 | } 28 | 29 | - (void)insertRow:(NSUInteger)row inSection:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation { 30 | NSIndexPath *toInsert = [NSIndexPath indexPathForRow:row inSection:section]; 31 | [self insertRowAtIndexPath:toInsert withRowAnimation:animation]; 32 | } 33 | 34 | - (void)reloadRowAtIndexPath:(NSIndexPath *)indexPath withRowAnimation:(UITableViewRowAnimation)animation { 35 | [self reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:animation]; 36 | } 37 | 38 | - (void)reloadRow:(NSUInteger)row inSection:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation { 39 | NSIndexPath *toReload = [NSIndexPath indexPathForRow:row inSection:section]; 40 | [self reloadRowAtIndexPath:toReload withRowAnimation:animation]; 41 | } 42 | 43 | - (void)deleteRowAtIndexPath:(NSIndexPath *)indexPath withRowAnimation:(UITableViewRowAnimation)animation { 44 | [self deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:animation]; 45 | } 46 | 47 | - (void)deleteRow:(NSUInteger)row inSection:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation { 48 | NSIndexPath *toDelete = [NSIndexPath indexPathForRow:row inSection:section]; 49 | [self deleteRowAtIndexPath:toDelete withRowAnimation:animation]; 50 | } 51 | 52 | - (void)insertSection:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation { 53 | NSIndexSet *sections = [NSIndexSet indexSetWithIndex:section]; 54 | [self insertSections:sections withRowAnimation:animation]; 55 | } 56 | 57 | - (void)deleteSection:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation { 58 | NSIndexSet *sections = [NSIndexSet indexSetWithIndex:section]; 59 | [self deleteSections:sections withRowAnimation:animation]; 60 | } 61 | 62 | - (void)reloadSection:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation { 63 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:section]; 64 | [self reloadSections:indexSet withRowAnimation:animation]; 65 | } 66 | 67 | - (void)clearSelectedRowsAnimated:(BOOL)animated { 68 | NSArray *indexs = [self indexPathsForSelectedRows]; 69 | [indexs enumerateObjectsUsingBlock:^(NSIndexPath* path, NSUInteger idx, BOOL *stop) { 70 | [self deselectRowAtIndexPath:path animated:animated]; 71 | }]; 72 | } 73 | @end 74 | -------------------------------------------------------------------------------- /HDTableViewMaker/UITableView+HDTableViewMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+HDTableViewDataSource.h 3 | // CBTableViewDataSourceDemo 4 | // 5 | // Created by 洪东 on 7/15/16. 6 | // Copyright © 2016 Cocbin. All rights reserved. 7 | // 8 | 9 | #import 10 | @class HDBaseTableViewDataSource,HDTableViewMaker; 11 | @interface UITableView (HDTableViewMaker) 12 | 13 | @property(nonatomic, strong) HDBaseTableViewDataSource * hdTableViewDataSource; 14 | 15 | @property (nonatomic,strong) NSMutableDictionary *tableViewRegisterCell; 16 | 17 | 18 | - (UITableView *)hd_tableViewMaker:(void (^)(HDTableViewMaker * tableMaker))tableViewMaker; 19 | 20 | 21 | @end 22 | 23 | __attribute__((unused)) static void commitEditing(id self, SEL cmd, UITableView * tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath * indexPath); 24 | 25 | __attribute__((unused)) static void scrollViewDidScroll(id self, SEL cmd, UIScrollView * scrollView); 26 | 27 | __attribute__((unused)) static void cellWillDisplay(id self, SEL cmd, UITableView *tableView,UITableViewCell *willDisplayCell,NSIndexPath *indexPath); 28 | 29 | -------------------------------------------------------------------------------- /HDTableViewMaker/UITableViewCell+HDTableViewMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+HDTableViewDataSource.h 3 | // wash4b 4 | // 5 | // Created by 洪东 on 7/20/16. 6 | // Copyright © 2016 abnerh. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UITableViewCell (HDTableViewMaker) 12 | @property (nonatomic,weak) UITableView *tableView; 13 | 14 | @property (nonatomic, strong) NSIndexPath *indexPath; 15 | 16 | - (void)reloadRow:(UITableViewRowAnimation)animation; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /HDTableViewMaker/UITableViewCell+HDTableViewMaker.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+HDTableViewDataSource.m 3 | // wash4b 4 | // 5 | // Created by 洪东 on 7/20/16. 6 | // Copyright © 2016 abnerh. All rights reserved. 7 | // 8 | 9 | #import "UITableViewCell+HDTableViewMaker.h" 10 | #import "NSObject+HDAssociated.h" 11 | 12 | @implementation UITableViewCell (HDTableViewMaker) 13 | -(NSIndexPath *)indexPath{ 14 | NSIndexPath *indexPath=objc_getAssociatedObject(self, _cmd); 15 | return indexPath; 16 | } 17 | -(void)setIndexPath:(NSIndexPath *)indexPath{ 18 | objc_setAssociatedObject(self, @selector(indexPath), indexPath, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 19 | } 20 | 21 | - (UITableView *)tableView 22 | { 23 | UITableView *curTableView = [self hd_getAssociatedObjectWithKey:_cmd]; 24 | if (curTableView) return curTableView; 25 | 26 | // curTableView = [self hd_findSupview:@"UITableView"]; 27 | // if (curTableView) { 28 | // self.tableView = curTableView; 29 | // } 30 | return curTableView; 31 | } 32 | 33 | - (void)setTableView:(UITableView *)tableView 34 | { 35 | [self hd_setAssociatedAssignObject:tableView key:@selector(tableView)]; 36 | } 37 | 38 | - (void)reloadRow:(UITableViewRowAnimation)animation{ 39 | [self.tableView reloadRowsAtIndexPaths:@[self.indexPath] withRowAnimation:animation]; 40 | } 41 | @end 42 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // HDTableViewDataSourceDemo 4 | // 5 | // Created by Abner on 16/7/16. 6 | // Copyright © 2016年 Abner. 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 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // HDTableViewDataSourceDemo 4 | // 5 | // Created by Abner on 16/7/16. 6 | // Copyright © 2016年 Abner. 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 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /HDTableViewMakerDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/Cell/HDTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewCell.h 3 | // HDTableViewDataSourceDemo 4 | // 5 | // Created by Abner on 16/7/16. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDTableViewCell : UITableViewCell 12 | @property (nonatomic, strong) NSString *title; 13 | @end 14 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/Cell/HDTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDTableViewCell.m 3 | // HDTableViewDataSourceDemo 4 | // 5 | // Created by Abner on 16/7/16. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #import "HDTableViewCell.h" 10 | 11 | @interface HDTableViewCell () 12 | 13 | @property (weak, nonatomic) IBOutlet UILabel *titleLbl; 14 | 15 | @end 16 | 17 | @implementation HDTableViewCell 18 | 19 | - (void)awakeFromNib { 20 | [super awakeFromNib]; 21 | // Initialization code 22 | } 23 | 24 | -(void)setTitle:(NSString *)title{ 25 | _title = title; 26 | _titleLbl.text = title; 27 | 28 | } 29 | 30 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 31 | [super setSelected:selected animated:animated]; 32 | 33 | // Configure the view for the selected state 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/Cell/HDTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // HDTableViewDataSourceDemo 4 | // 5 | // Created by Abner on 16/7/16. 6 | // Copyright © 2016年 Abner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /HDTableViewMakerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HDTableViewDataSourceDemo 4 | // 5 | // Created by Abner on 16/7/16. 6 | // Copyright © 2016年 Abner. 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 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, "7.0" 2 | 3 | target 'HDTableViewMakerDemo' do 4 | 5 | pod 'UITableView+FDTemplateLayoutCell' 6 | 7 | pod 'MJRefresh' 8 | 9 | pod 'Masonry' 10 | 11 | end 12 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Masonry (1.1.0) 3 | - MJRefresh (3.1.15) 4 | - UITableView+FDTemplateLayoutCell (1.6) 5 | 6 | DEPENDENCIES: 7 | - Masonry 8 | - MJRefresh 9 | - UITableView+FDTemplateLayoutCell 10 | 11 | SPEC CHECKSUMS: 12 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 13 | MJRefresh: 9af70f5f9327a2cf87f0fb5929f35fcc2fa638ea 14 | UITableView+FDTemplateLayoutCell: 5c949b4a5059c404b442926c0e80f81d10a2d66f 15 | 16 | PODFILE CHECKSUM: 816f0f1b306568c869714081d9f2fdc574921d57 17 | 18 | COCOAPODS: 1.3.1 19 | -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefresh.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/MJRefresh.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshAutoFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshAutoGifFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshAutoNormalFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshAutoStateFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshBackFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshBackFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshBackGifFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshBackNormalFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshBackStateFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshComponent.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshComponent.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshConst.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/MJRefreshConst.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshGifHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshNormalHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/MJRefreshStateHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/NSBundle+MJRefresh.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/NSBundle+MJRefresh.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/UIScrollView+MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/UIScrollView+MJRefresh.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJRefresh.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJRefresh/UIView+MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/UIView+MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/UITableView+FDTemplateLayoutCell/UITableView+FDIndexPathHeightCache.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDIndexPathHeightCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/UITableView+FDTemplateLayoutCell/UITableView+FDKeyedHeightCache.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCell.h -------------------------------------------------------------------------------- /Pods/Headers/Private/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCellDebug.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefresh.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/MJRefresh.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshAutoFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshAutoGifFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshAutoNormalFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshAutoStateFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshBackFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshBackFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshBackGifFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshBackNormalFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshBackStateFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshComponent.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshComponent.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshConst.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/MJRefreshConst.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshFooter.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshFooter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshGifHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshNormalHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/MJRefreshStateHeader.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/NSBundle+MJRefresh.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/NSBundle+MJRefresh.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/UIScrollView+MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/UIScrollView+MJRefresh.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJRefresh.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJRefresh/UIView+MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJRefresh/MJRefresh/UIView+MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/UITableView+FDTemplateLayoutCell/UITableView+FDIndexPathHeightCache.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDIndexPathHeightCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/UITableView+FDTemplateLayoutCell/UITableView+FDKeyedHeightCache.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCell.h -------------------------------------------------------------------------------- /Pods/Headers/Public/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCellDebug.h: -------------------------------------------------------------------------------- 1 | ../../../UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.h -------------------------------------------------------------------------------- /Pods/MJRefresh/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh) 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 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshFooter.h" 10 | 11 | @interface MJRefreshAutoFooter : MJRefreshFooter 12 | /** 是否自动刷新(默认为YES) */ 13 | @property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh; 14 | 15 | /** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */ 16 | @property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh MJRefreshDeprecated("请使用triggerAutomaticallyRefreshPercent属性"); 17 | 18 | /** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */ 19 | @property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent; 20 | @end 21 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshAutoFooter.h" 10 | 11 | @interface MJRefreshAutoFooter() 12 | @end 13 | 14 | @implementation MJRefreshAutoFooter 15 | 16 | #pragma mark - 初始化 17 | - (void)willMoveToSuperview:(UIView *)newSuperview 18 | { 19 | [super willMoveToSuperview:newSuperview]; 20 | 21 | if (newSuperview) { // 新的父控件 22 | if (self.hidden == NO) { 23 | self.scrollView.mj_insetB += self.mj_h; 24 | } 25 | 26 | // 设置位置 27 | self.mj_y = _scrollView.mj_contentH; 28 | } else { // 被移除了 29 | if (self.hidden == NO) { 30 | self.scrollView.mj_insetB -= self.mj_h; 31 | } 32 | } 33 | } 34 | 35 | #pragma mark - 过期方法 36 | - (void)setAppearencePercentTriggerAutoRefresh:(CGFloat)appearencePercentTriggerAutoRefresh 37 | { 38 | self.triggerAutomaticallyRefreshPercent = appearencePercentTriggerAutoRefresh; 39 | } 40 | 41 | - (CGFloat)appearencePercentTriggerAutoRefresh 42 | { 43 | return self.triggerAutomaticallyRefreshPercent; 44 | } 45 | 46 | #pragma mark - 实现父类的方法 47 | - (void)prepare 48 | { 49 | [super prepare]; 50 | 51 | // 默认底部控件100%出现时才会自动刷新 52 | self.triggerAutomaticallyRefreshPercent = 1.0; 53 | 54 | // 设置为默认状态 55 | self.automaticallyRefresh = YES; 56 | } 57 | 58 | - (void)scrollViewContentSizeDidChange:(NSDictionary *)change 59 | { 60 | [super scrollViewContentSizeDidChange:change]; 61 | 62 | // 设置位置 63 | self.mj_y = self.scrollView.mj_contentH; 64 | } 65 | 66 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change 67 | { 68 | [super scrollViewContentOffsetDidChange:change]; 69 | 70 | if (self.state != MJRefreshStateIdle || !self.automaticallyRefresh || self.mj_y == 0) return; 71 | 72 | if (_scrollView.mj_insetT + _scrollView.mj_contentH > _scrollView.mj_h) { // 内容超过一个屏幕 73 | // 这里的_scrollView.mj_contentH替换掉self.mj_y更为合理 74 | if (_scrollView.mj_offsetY >= _scrollView.mj_contentH - _scrollView.mj_h + self.mj_h * self.triggerAutomaticallyRefreshPercent + _scrollView.mj_insetB - self.mj_h) { 75 | // 防止手松开时连续调用 76 | CGPoint old = [change[@"old"] CGPointValue]; 77 | CGPoint new = [change[@"new"] CGPointValue]; 78 | if (new.y <= old.y) return; 79 | 80 | // 当底部刷新控件完全出现时,才刷新 81 | [self beginRefreshing]; 82 | } 83 | } 84 | } 85 | 86 | - (void)scrollViewPanStateDidChange:(NSDictionary *)change 87 | { 88 | [super scrollViewPanStateDidChange:change]; 89 | 90 | if (self.state != MJRefreshStateIdle) return; 91 | 92 | if (_scrollView.panGestureRecognizer.state == UIGestureRecognizerStateEnded) {// 手松开 93 | if (_scrollView.mj_insetT + _scrollView.mj_contentH <= _scrollView.mj_h) { // 不够一个屏幕 94 | if (_scrollView.mj_offsetY >= - _scrollView.mj_insetT) { // 向上拽 95 | [self beginRefreshing]; 96 | } 97 | } else { // 超出一个屏幕 98 | if (_scrollView.mj_offsetY >= _scrollView.mj_contentH + _scrollView.mj_insetB - _scrollView.mj_h) { 99 | [self beginRefreshing]; 100 | } 101 | } 102 | } 103 | } 104 | 105 | - (void)setState:(MJRefreshState)state 106 | { 107 | MJRefreshCheckState 108 | 109 | if (state == MJRefreshStateRefreshing) { 110 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 111 | [self executeRefreshingCallback]; 112 | }); 113 | } else if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { 114 | if (MJRefreshStateRefreshing == oldState) { 115 | if (self.endRefreshingCompletionBlock) { 116 | self.endRefreshingCompletionBlock(); 117 | } 118 | } 119 | } 120 | } 121 | 122 | - (void)setHidden:(BOOL)hidden 123 | { 124 | BOOL lastHidden = self.isHidden; 125 | 126 | [super setHidden:hidden]; 127 | 128 | if (!lastHidden && hidden) { 129 | self.state = MJRefreshStateIdle; 130 | 131 | self.scrollView.mj_insetB -= self.mj_h; 132 | } else if (lastHidden && !hidden) { 133 | self.scrollView.mj_insetB += self.mj_h; 134 | 135 | // 设置位置 136 | self.mj_y = _scrollView.mj_contentH; 137 | } 138 | } 139 | @end 140 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Base/MJRefreshBackFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshFooter.h" 10 | 11 | @interface MJRefreshBackFooter : MJRefreshFooter 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Base/MJRefreshComponent.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // MJRefreshComponent.h 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 15/3/4. 7 | // Copyright (c) 2015年 小码哥. All rights reserved. 8 | // 刷新控件的基类 9 | 10 | #import 11 | #import "MJRefreshConst.h" 12 | #import "UIView+MJExtension.h" 13 | #import "UIScrollView+MJExtension.h" 14 | #import "UIScrollView+MJRefresh.h" 15 | #import "NSBundle+MJRefresh.h" 16 | 17 | /** 刷新控件的状态 */ 18 | typedef NS_ENUM(NSInteger, MJRefreshState) { 19 | /** 普通闲置状态 */ 20 | MJRefreshStateIdle = 1, 21 | /** 松开就可以进行刷新的状态 */ 22 | MJRefreshStatePulling, 23 | /** 正在刷新中的状态 */ 24 | MJRefreshStateRefreshing, 25 | /** 即将刷新的状态 */ 26 | MJRefreshStateWillRefresh, 27 | /** 所有数据加载完毕,没有更多的数据了 */ 28 | MJRefreshStateNoMoreData 29 | }; 30 | 31 | /** 进入刷新状态的回调 */ 32 | typedef void (^MJRefreshComponentRefreshingBlock)(void); 33 | /** 开始刷新后的回调(进入刷新状态后的回调) */ 34 | typedef void (^MJRefreshComponentbeginRefreshingCompletionBlock)(void); 35 | /** 结束刷新后的回调 */ 36 | typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(void); 37 | 38 | /** 刷新控件的基类 */ 39 | @interface MJRefreshComponent : UIView 40 | { 41 | /** 记录scrollView刚开始的inset */ 42 | UIEdgeInsets _scrollViewOriginalInset; 43 | /** 父控件 */ 44 | __weak UIScrollView *_scrollView; 45 | } 46 | #pragma mark - 刷新回调 47 | /** 正在刷新的回调 */ 48 | @property (copy, nonatomic) MJRefreshComponentRefreshingBlock refreshingBlock; 49 | /** 设置回调对象和回调方法 */ 50 | - (void)setRefreshingTarget:(id)target refreshingAction:(SEL)action; 51 | 52 | /** 回调对象 */ 53 | @property (weak, nonatomic) id refreshingTarget; 54 | /** 回调方法 */ 55 | @property (assign, nonatomic) SEL refreshingAction; 56 | /** 触发回调(交给子类去调用) */ 57 | - (void)executeRefreshingCallback; 58 | 59 | #pragma mark - 刷新状态控制 60 | /** 进入刷新状态 */ 61 | - (void)beginRefreshing; 62 | - (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock; 63 | /** 开始刷新后的回调(进入刷新状态后的回调) */ 64 | @property (copy, nonatomic) MJRefreshComponentbeginRefreshingCompletionBlock beginRefreshingCompletionBlock; 65 | /** 结束刷新的回调 */ 66 | @property (copy, nonatomic) MJRefreshComponentEndRefreshingCompletionBlock endRefreshingCompletionBlock; 67 | /** 结束刷新状态 */ 68 | - (void)endRefreshing; 69 | - (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock; 70 | /** 是否正在刷新 */ 71 | @property (assign, nonatomic, readonly, getter=isRefreshing) BOOL refreshing; 72 | //- (BOOL)isRefreshing; 73 | /** 刷新状态 一般交给子类内部实现 */ 74 | @property (assign, nonatomic) MJRefreshState state; 75 | 76 | #pragma mark - 交给子类去访问 77 | /** 记录scrollView刚开始的inset */ 78 | @property (assign, nonatomic, readonly) UIEdgeInsets scrollViewOriginalInset; 79 | /** 父控件 */ 80 | @property (weak, nonatomic, readonly) UIScrollView *scrollView; 81 | 82 | #pragma mark - 交给子类们去实现 83 | /** 初始化 */ 84 | - (void)prepare NS_REQUIRES_SUPER; 85 | /** 摆放子控件frame */ 86 | - (void)placeSubviews NS_REQUIRES_SUPER; 87 | /** 当scrollView的contentOffset发生改变的时候调用 */ 88 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change NS_REQUIRES_SUPER; 89 | /** 当scrollView的contentSize发生改变的时候调用 */ 90 | - (void)scrollViewContentSizeDidChange:(NSDictionary *)change NS_REQUIRES_SUPER; 91 | /** 当scrollView的拖拽状态发生改变的时候调用 */ 92 | - (void)scrollViewPanStateDidChange:(NSDictionary *)change NS_REQUIRES_SUPER; 93 | 94 | 95 | #pragma mark - 其他 96 | /** 拉拽的百分比(交给子类重写) */ 97 | @property (assign, nonatomic) CGFloat pullingPercent; 98 | /** 根据拖拽比例自动切换透明度 */ 99 | @property (assign, nonatomic, getter=isAutoChangeAlpha) BOOL autoChangeAlpha MJRefreshDeprecated("请使用automaticallyChangeAlpha属性"); 100 | /** 根据拖拽比例自动切换透明度 */ 101 | @property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha; 102 | @end 103 | 104 | @interface UILabel(MJRefresh) 105 | + (instancetype)mj_label; 106 | - (CGFloat)mj_textWith; 107 | @end 108 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Base/MJRefreshFooter.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // MJRefreshFooter.h 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 15/3/5. 7 | // Copyright (c) 2015年 小码哥. All rights reserved. 8 | // 上拉刷新控件 9 | 10 | #import "MJRefreshComponent.h" 11 | 12 | @interface MJRefreshFooter : MJRefreshComponent 13 | /** 创建footer */ 14 | + (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock; 15 | /** 创建footer */ 16 | + (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action; 17 | 18 | /** 提示没有更多的数据 */ 19 | - (void)endRefreshingWithNoMoreData; 20 | - (void)noticeNoMoreData MJRefreshDeprecated("使用endRefreshingWithNoMoreData"); 21 | 22 | /** 重置没有更多的数据(消除没有更多数据的状态) */ 23 | - (void)resetNoMoreData; 24 | 25 | /** 忽略多少scrollView的contentInset的bottom */ 26 | @property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom; 27 | 28 | /** 自动根据有无数据来显示和隐藏(有数据就显示,没有数据隐藏。默认是NO) */ 29 | @property (assign, nonatomic, getter=isAutomaticallyHidden) BOOL automaticallyHidden; 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Base/MJRefreshFooter.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // MJRefreshFooter.m 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 15/3/5. 7 | // Copyright (c) 2015年 小码哥. All rights reserved. 8 | // 9 | 10 | #import "MJRefreshFooter.h" 11 | 12 | @interface MJRefreshFooter() 13 | 14 | @end 15 | 16 | @implementation MJRefreshFooter 17 | #pragma mark - 构造方法 18 | + (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock 19 | { 20 | MJRefreshFooter *cmp = [[self alloc] init]; 21 | cmp.refreshingBlock = refreshingBlock; 22 | return cmp; 23 | } 24 | + (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action 25 | { 26 | MJRefreshFooter *cmp = [[self alloc] init]; 27 | [cmp setRefreshingTarget:target refreshingAction:action]; 28 | return cmp; 29 | } 30 | 31 | #pragma mark - 重写父类的方法 32 | - (void)prepare 33 | { 34 | [super prepare]; 35 | 36 | // 设置自己的高度 37 | self.mj_h = MJRefreshFooterHeight; 38 | 39 | // 默认不会自动隐藏 40 | self.automaticallyHidden = NO; 41 | } 42 | 43 | - (void)willMoveToSuperview:(UIView *)newSuperview 44 | { 45 | [super willMoveToSuperview:newSuperview]; 46 | 47 | if (newSuperview) { 48 | // 监听scrollView数据的变化 49 | if ([self.scrollView isKindOfClass:[UITableView class]] || [self.scrollView isKindOfClass:[UICollectionView class]]) { 50 | [self.scrollView setMj_reloadDataBlock:^(NSInteger totalDataCount) { 51 | if (self.isAutomaticallyHidden) { 52 | self.hidden = (totalDataCount == 0); 53 | } 54 | }]; 55 | } 56 | } 57 | } 58 | 59 | #pragma mark - 公共方法 60 | - (void)endRefreshingWithNoMoreData 61 | { 62 | dispatch_async(dispatch_get_main_queue(), ^{ 63 | self.state = MJRefreshStateNoMoreData; 64 | }); 65 | } 66 | 67 | - (void)noticeNoMoreData 68 | { 69 | [self endRefreshingWithNoMoreData]; 70 | } 71 | 72 | - (void)resetNoMoreData 73 | { 74 | dispatch_async(dispatch_get_main_queue(), ^{ 75 | self.state = MJRefreshStateIdle; 76 | }); 77 | } 78 | @end 79 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Base/MJRefreshHeader.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // MJRefreshHeader.h 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 15/3/4. 7 | // Copyright (c) 2015年 小码哥. All rights reserved. 8 | // 下拉刷新控件:负责监控用户下拉的状态 9 | 10 | #import "MJRefreshComponent.h" 11 | 12 | @interface MJRefreshHeader : MJRefreshComponent 13 | /** 创建header */ 14 | + (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock; 15 | /** 创建header */ 16 | + (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action; 17 | 18 | /** 这个key用来存储上一次下拉刷新成功的时间 */ 19 | @property (copy, nonatomic) NSString *lastUpdatedTimeKey; 20 | /** 上一次下拉刷新成功的时间 */ 21 | @property (strong, nonatomic, readonly) NSDate *lastUpdatedTime; 22 | 23 | /** 忽略多少scrollView的contentInset的top */ 24 | @property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop; 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoGifFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshAutoStateFooter.h" 10 | 11 | @interface MJRefreshAutoGifFooter : MJRefreshAutoStateFooter 12 | @property (weak, nonatomic, readonly) UIImageView *gifView; 13 | 14 | /** 设置state状态下的动画图片images 动画持续时间duration*/ 15 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state; 16 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state; 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoGifFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshAutoGifFooter.h" 10 | 11 | @interface MJRefreshAutoGifFooter() 12 | { 13 | __unsafe_unretained UIImageView *_gifView; 14 | } 15 | /** 所有状态对应的动画图片 */ 16 | @property (strong, nonatomic) NSMutableDictionary *stateImages; 17 | /** 所有状态对应的动画时间 */ 18 | @property (strong, nonatomic) NSMutableDictionary *stateDurations; 19 | @end 20 | 21 | @implementation MJRefreshAutoGifFooter 22 | #pragma mark - 懒加载 23 | - (UIImageView *)gifView 24 | { 25 | if (!_gifView) { 26 | UIImageView *gifView = [[UIImageView alloc] init]; 27 | [self addSubview:_gifView = gifView]; 28 | } 29 | return _gifView; 30 | } 31 | 32 | - (NSMutableDictionary *)stateImages 33 | { 34 | if (!_stateImages) { 35 | self.stateImages = [NSMutableDictionary dictionary]; 36 | } 37 | return _stateImages; 38 | } 39 | 40 | - (NSMutableDictionary *)stateDurations 41 | { 42 | if (!_stateDurations) { 43 | self.stateDurations = [NSMutableDictionary dictionary]; 44 | } 45 | return _stateDurations; 46 | } 47 | 48 | #pragma mark - 公共方法 49 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state 50 | { 51 | if (images == nil) return; 52 | 53 | self.stateImages[@(state)] = images; 54 | self.stateDurations[@(state)] = @(duration); 55 | 56 | /* 根据图片设置控件的高度 */ 57 | UIImage *image = [images firstObject]; 58 | if (image.size.height > self.mj_h) { 59 | self.mj_h = image.size.height; 60 | } 61 | } 62 | 63 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state 64 | { 65 | [self setImages:images duration:images.count * 0.1 forState:state]; 66 | } 67 | 68 | #pragma mark - 实现父类的方法 69 | - (void)prepare 70 | { 71 | [super prepare]; 72 | 73 | // 初始化间距 74 | self.labelLeftInset = 20; 75 | } 76 | 77 | - (void)placeSubviews 78 | { 79 | [super placeSubviews]; 80 | 81 | if (self.gifView.constraints.count) return; 82 | 83 | self.gifView.frame = self.bounds; 84 | if (self.isRefreshingTitleHidden) { 85 | self.gifView.contentMode = UIViewContentModeCenter; 86 | } else { 87 | self.gifView.contentMode = UIViewContentModeRight; 88 | self.gifView.mj_w = self.mj_w * 0.5 - self.labelLeftInset - self.stateLabel.mj_textWith * 0.5; 89 | } 90 | } 91 | 92 | - (void)setState:(MJRefreshState)state 93 | { 94 | MJRefreshCheckState 95 | 96 | // 根据状态做事情 97 | if (state == MJRefreshStateRefreshing) { 98 | NSArray *images = self.stateImages[@(state)]; 99 | if (images.count == 0) return; 100 | [self.gifView stopAnimating]; 101 | 102 | self.gifView.hidden = NO; 103 | if (images.count == 1) { // 单张图片 104 | self.gifView.image = [images lastObject]; 105 | } else { // 多张图片 106 | self.gifView.animationImages = images; 107 | self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue]; 108 | [self.gifView startAnimating]; 109 | } 110 | } else if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { 111 | [self.gifView stopAnimating]; 112 | self.gifView.hidden = YES; 113 | } 114 | } 115 | @end 116 | 117 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoNormalFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshAutoStateFooter.h" 10 | 11 | @interface MJRefreshAutoNormalFooter : MJRefreshAutoStateFooter 12 | /** 菊花的样式 */ 13 | @property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; 14 | @end 15 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoNormalFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshAutoNormalFooter.h" 10 | 11 | @interface MJRefreshAutoNormalFooter() 12 | @property (weak, nonatomic) UIActivityIndicatorView *loadingView; 13 | @end 14 | 15 | @implementation MJRefreshAutoNormalFooter 16 | #pragma mark - 懒加载子控件 17 | - (UIActivityIndicatorView *)loadingView 18 | { 19 | if (!_loadingView) { 20 | UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:self.activityIndicatorViewStyle]; 21 | loadingView.hidesWhenStopped = YES; 22 | [self addSubview:_loadingView = loadingView]; 23 | } 24 | return _loadingView; 25 | } 26 | 27 | - (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle 28 | { 29 | _activityIndicatorViewStyle = activityIndicatorViewStyle; 30 | 31 | self.loadingView = nil; 32 | [self setNeedsLayout]; 33 | } 34 | #pragma mark - 重写父类的方法 35 | - (void)prepare 36 | { 37 | [super prepare]; 38 | 39 | self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 40 | } 41 | 42 | - (void)placeSubviews 43 | { 44 | [super placeSubviews]; 45 | 46 | if (self.loadingView.constraints.count) return; 47 | 48 | // 圈圈 49 | CGFloat loadingCenterX = self.mj_w * 0.5; 50 | if (!self.isRefreshingTitleHidden) { 51 | loadingCenterX -= self.stateLabel.mj_textWith * 0.5 + self.labelLeftInset; 52 | } 53 | CGFloat loadingCenterY = self.mj_h * 0.5; 54 | self.loadingView.center = CGPointMake(loadingCenterX, loadingCenterY); 55 | } 56 | 57 | - (void)setState:(MJRefreshState)state 58 | { 59 | MJRefreshCheckState 60 | 61 | // 根据状态做事情 62 | if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { 63 | [self.loadingView stopAnimating]; 64 | } else if (state == MJRefreshStateRefreshing) { 65 | [self.loadingView startAnimating]; 66 | } 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoStateFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/6/13. 6 | // Copyright © 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshAutoFooter.h" 10 | 11 | @interface MJRefreshAutoStateFooter : MJRefreshAutoFooter 12 | /** 文字距离圈圈、箭头的距离 */ 13 | @property (assign, nonatomic) CGFloat labelLeftInset; 14 | /** 显示刷新状态的label */ 15 | @property (weak, nonatomic, readonly) UILabel *stateLabel; 16 | 17 | /** 设置state状态下的文字 */ 18 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state; 19 | 20 | /** 隐藏刷新状态的文字 */ 21 | @property (assign, nonatomic, getter=isRefreshingTitleHidden) BOOL refreshingTitleHidden; 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshAutoStateFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/6/13. 6 | // Copyright © 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshAutoStateFooter.h" 10 | 11 | @interface MJRefreshAutoStateFooter() 12 | { 13 | /** 显示刷新状态的label */ 14 | __unsafe_unretained UILabel *_stateLabel; 15 | } 16 | /** 所有状态对应的文字 */ 17 | @property (strong, nonatomic) NSMutableDictionary *stateTitles; 18 | @end 19 | 20 | @implementation MJRefreshAutoStateFooter 21 | #pragma mark - 懒加载 22 | - (NSMutableDictionary *)stateTitles 23 | { 24 | if (!_stateTitles) { 25 | self.stateTitles = [NSMutableDictionary dictionary]; 26 | } 27 | return _stateTitles; 28 | } 29 | 30 | - (UILabel *)stateLabel 31 | { 32 | if (!_stateLabel) { 33 | [self addSubview:_stateLabel = [UILabel mj_label]]; 34 | } 35 | return _stateLabel; 36 | } 37 | 38 | #pragma mark - 公共方法 39 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state 40 | { 41 | if (title == nil) return; 42 | self.stateTitles[@(state)] = title; 43 | self.stateLabel.text = self.stateTitles[@(self.state)]; 44 | } 45 | 46 | #pragma mark - 私有方法 47 | - (void)stateLabelClick 48 | { 49 | if (self.state == MJRefreshStateIdle) { 50 | [self beginRefreshing]; 51 | } 52 | } 53 | 54 | #pragma mark - 重写父类的方法 55 | - (void)prepare 56 | { 57 | [super prepare]; 58 | 59 | // 初始化间距 60 | self.labelLeftInset = MJRefreshLabelLeftInset; 61 | 62 | // 初始化文字 63 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterIdleText] forState:MJRefreshStateIdle]; 64 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterRefreshingText] forState:MJRefreshStateRefreshing]; 65 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterNoMoreDataText] forState:MJRefreshStateNoMoreData]; 66 | 67 | // 监听label 68 | self.stateLabel.userInteractionEnabled = YES; 69 | [self.stateLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(stateLabelClick)]]; 70 | } 71 | 72 | - (void)placeSubviews 73 | { 74 | [super placeSubviews]; 75 | 76 | if (self.stateLabel.constraints.count) return; 77 | 78 | // 状态标签 79 | self.stateLabel.frame = self.bounds; 80 | } 81 | 82 | - (void)setState:(MJRefreshState)state 83 | { 84 | MJRefreshCheckState 85 | 86 | if (self.isRefreshingTitleHidden && state == MJRefreshStateRefreshing) { 87 | self.stateLabel.text = nil; 88 | } else { 89 | self.stateLabel.text = self.stateTitles[@(state)]; 90 | } 91 | } 92 | @end -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackGifFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshBackStateFooter.h" 10 | 11 | @interface MJRefreshBackGifFooter : MJRefreshBackStateFooter 12 | @property (weak, nonatomic, readonly) UIImageView *gifView; 13 | 14 | /** 设置state状态下的动画图片images 动画持续时间duration*/ 15 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state; 16 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state; 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackGifFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshBackGifFooter.h" 10 | 11 | @interface MJRefreshBackGifFooter() 12 | { 13 | __unsafe_unretained UIImageView *_gifView; 14 | } 15 | /** 所有状态对应的动画图片 */ 16 | @property (strong, nonatomic) NSMutableDictionary *stateImages; 17 | /** 所有状态对应的动画时间 */ 18 | @property (strong, nonatomic) NSMutableDictionary *stateDurations; 19 | @end 20 | 21 | @implementation MJRefreshBackGifFooter 22 | #pragma mark - 懒加载 23 | - (UIImageView *)gifView 24 | { 25 | if (!_gifView) { 26 | UIImageView *gifView = [[UIImageView alloc] init]; 27 | [self addSubview:_gifView = gifView]; 28 | } 29 | return _gifView; 30 | } 31 | 32 | - (NSMutableDictionary *)stateImages 33 | { 34 | if (!_stateImages) { 35 | self.stateImages = [NSMutableDictionary dictionary]; 36 | } 37 | return _stateImages; 38 | } 39 | 40 | - (NSMutableDictionary *)stateDurations 41 | { 42 | if (!_stateDurations) { 43 | self.stateDurations = [NSMutableDictionary dictionary]; 44 | } 45 | return _stateDurations; 46 | } 47 | 48 | #pragma mark - 公共方法 49 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state 50 | { 51 | if (images == nil) return; 52 | 53 | self.stateImages[@(state)] = images; 54 | self.stateDurations[@(state)] = @(duration); 55 | 56 | /* 根据图片设置控件的高度 */ 57 | UIImage *image = [images firstObject]; 58 | if (image.size.height > self.mj_h) { 59 | self.mj_h = image.size.height; 60 | } 61 | } 62 | 63 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state 64 | { 65 | [self setImages:images duration:images.count * 0.1 forState:state]; 66 | } 67 | 68 | #pragma mark - 实现父类的方法 69 | - (void)prepare 70 | { 71 | [super prepare]; 72 | 73 | // 初始化间距 74 | self.labelLeftInset = 20; 75 | } 76 | 77 | - (void)setPullingPercent:(CGFloat)pullingPercent 78 | { 79 | [super setPullingPercent:pullingPercent]; 80 | NSArray *images = self.stateImages[@(MJRefreshStateIdle)]; 81 | if (self.state != MJRefreshStateIdle || images.count == 0) return; 82 | [self.gifView stopAnimating]; 83 | NSUInteger index = images.count * pullingPercent; 84 | if (index >= images.count) index = images.count - 1; 85 | self.gifView.image = images[index]; 86 | } 87 | 88 | - (void)placeSubviews 89 | { 90 | [super placeSubviews]; 91 | 92 | if (self.gifView.constraints.count) return; 93 | 94 | self.gifView.frame = self.bounds; 95 | if (self.stateLabel.hidden) { 96 | self.gifView.contentMode = UIViewContentModeCenter; 97 | } else { 98 | self.gifView.contentMode = UIViewContentModeRight; 99 | self.gifView.mj_w = self.mj_w * 0.5 - self.labelLeftInset - self.stateLabel.mj_textWith * 0.5; 100 | } 101 | } 102 | 103 | - (void)setState:(MJRefreshState)state 104 | { 105 | MJRefreshCheckState 106 | 107 | // 根据状态做事情 108 | if (state == MJRefreshStatePulling || state == MJRefreshStateRefreshing) { 109 | NSArray *images = self.stateImages[@(state)]; 110 | if (images.count == 0) return; 111 | 112 | self.gifView.hidden = NO; 113 | [self.gifView stopAnimating]; 114 | if (images.count == 1) { // 单张图片 115 | self.gifView.image = [images lastObject]; 116 | } else { // 多张图片 117 | self.gifView.animationImages = images; 118 | self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue]; 119 | [self.gifView startAnimating]; 120 | } 121 | } else if (state == MJRefreshStateIdle) { 122 | self.gifView.hidden = NO; 123 | } else if (state == MJRefreshStateNoMoreData) { 124 | self.gifView.hidden = YES; 125 | } 126 | } 127 | @end 128 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackNormalFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshBackStateFooter.h" 10 | 11 | @interface MJRefreshBackNormalFooter : MJRefreshBackStateFooter 12 | @property (weak, nonatomic, readonly) UIImageView *arrowView; 13 | /** 菊花的样式 */ 14 | @property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackNormalFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshBackNormalFooter.h" 10 | #import "NSBundle+MJRefresh.h" 11 | 12 | @interface MJRefreshBackNormalFooter() 13 | { 14 | __unsafe_unretained UIImageView *_arrowView; 15 | } 16 | @property (weak, nonatomic) UIActivityIndicatorView *loadingView; 17 | @end 18 | 19 | @implementation MJRefreshBackNormalFooter 20 | #pragma mark - 懒加载子控件 21 | - (UIImageView *)arrowView 22 | { 23 | if (!_arrowView) { 24 | UIImageView *arrowView = [[UIImageView alloc] initWithImage:[NSBundle mj_arrowImage]]; 25 | [self addSubview:_arrowView = arrowView]; 26 | } 27 | return _arrowView; 28 | } 29 | 30 | 31 | - (UIActivityIndicatorView *)loadingView 32 | { 33 | if (!_loadingView) { 34 | UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:self.activityIndicatorViewStyle]; 35 | loadingView.hidesWhenStopped = YES; 36 | [self addSubview:_loadingView = loadingView]; 37 | } 38 | return _loadingView; 39 | } 40 | 41 | - (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle 42 | { 43 | _activityIndicatorViewStyle = activityIndicatorViewStyle; 44 | 45 | self.loadingView = nil; 46 | [self setNeedsLayout]; 47 | } 48 | #pragma mark - 重写父类的方法 49 | - (void)prepare 50 | { 51 | [super prepare]; 52 | 53 | self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 54 | } 55 | 56 | - (void)placeSubviews 57 | { 58 | [super placeSubviews]; 59 | 60 | // 箭头的中心点 61 | CGFloat arrowCenterX = self.mj_w * 0.5; 62 | if (!self.stateLabel.hidden) { 63 | arrowCenterX -= self.labelLeftInset + self.stateLabel.mj_textWith * 0.5; 64 | } 65 | CGFloat arrowCenterY = self.mj_h * 0.5; 66 | CGPoint arrowCenter = CGPointMake(arrowCenterX, arrowCenterY); 67 | 68 | // 箭头 69 | if (self.arrowView.constraints.count == 0) { 70 | self.arrowView.mj_size = self.arrowView.image.size; 71 | self.arrowView.center = arrowCenter; 72 | } 73 | 74 | // 圈圈 75 | if (self.loadingView.constraints.count == 0) { 76 | self.loadingView.center = arrowCenter; 77 | } 78 | 79 | self.arrowView.tintColor = self.stateLabel.textColor; 80 | } 81 | 82 | - (void)setState:(MJRefreshState)state 83 | { 84 | MJRefreshCheckState 85 | 86 | // 根据状态做事情 87 | if (state == MJRefreshStateIdle) { 88 | if (oldState == MJRefreshStateRefreshing) { 89 | self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI); 90 | [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ 91 | self.loadingView.alpha = 0.0; 92 | } completion:^(BOOL finished) { 93 | self.loadingView.alpha = 1.0; 94 | [self.loadingView stopAnimating]; 95 | 96 | self.arrowView.hidden = NO; 97 | }]; 98 | } else { 99 | self.arrowView.hidden = NO; 100 | [self.loadingView stopAnimating]; 101 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 102 | self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI); 103 | }]; 104 | } 105 | } else if (state == MJRefreshStatePulling) { 106 | self.arrowView.hidden = NO; 107 | [self.loadingView stopAnimating]; 108 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 109 | self.arrowView.transform = CGAffineTransformIdentity; 110 | }]; 111 | } else if (state == MJRefreshStateRefreshing) { 112 | self.arrowView.hidden = YES; 113 | [self.loadingView startAnimating]; 114 | } else if (state == MJRefreshStateNoMoreData) { 115 | self.arrowView.hidden = YES; 116 | [self.loadingView stopAnimating]; 117 | } 118 | } 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackStateFooter.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/6/13. 6 | // Copyright © 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshBackFooter.h" 10 | 11 | @interface MJRefreshBackStateFooter : MJRefreshBackFooter 12 | /** 文字距离圈圈、箭头的距离 */ 13 | @property (assign, nonatomic) CGFloat labelLeftInset; 14 | /** 显示刷新状态的label */ 15 | @property (weak, nonatomic, readonly) UILabel *stateLabel; 16 | /** 设置state状态下的文字 */ 17 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state; 18 | 19 | /** 获取state状态下的title */ 20 | - (NSString *)titleForState:(MJRefreshState)state; 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackStateFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/6/13. 6 | // Copyright © 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshBackStateFooter.h" 10 | 11 | @interface MJRefreshBackStateFooter() 12 | { 13 | /** 显示刷新状态的label */ 14 | __unsafe_unretained UILabel *_stateLabel; 15 | } 16 | /** 所有状态对应的文字 */ 17 | @property (strong, nonatomic) NSMutableDictionary *stateTitles; 18 | @end 19 | 20 | @implementation MJRefreshBackStateFooter 21 | #pragma mark - 懒加载 22 | - (NSMutableDictionary *)stateTitles 23 | { 24 | if (!_stateTitles) { 25 | self.stateTitles = [NSMutableDictionary dictionary]; 26 | } 27 | return _stateTitles; 28 | } 29 | 30 | - (UILabel *)stateLabel 31 | { 32 | if (!_stateLabel) { 33 | [self addSubview:_stateLabel = [UILabel mj_label]]; 34 | } 35 | return _stateLabel; 36 | } 37 | 38 | #pragma mark - 公共方法 39 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state 40 | { 41 | if (title == nil) return; 42 | self.stateTitles[@(state)] = title; 43 | self.stateLabel.text = self.stateTitles[@(self.state)]; 44 | } 45 | 46 | - (NSString *)titleForState:(MJRefreshState)state { 47 | return self.stateTitles[@(state)]; 48 | } 49 | 50 | #pragma mark - 重写父类的方法 51 | - (void)prepare 52 | { 53 | [super prepare]; 54 | 55 | // 初始化间距 56 | self.labelLeftInset = MJRefreshLabelLeftInset; 57 | 58 | // 初始化文字 59 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterIdleText] forState:MJRefreshStateIdle]; 60 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterPullingText] forState:MJRefreshStatePulling]; 61 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterRefreshingText] forState:MJRefreshStateRefreshing]; 62 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterNoMoreDataText] forState:MJRefreshStateNoMoreData]; 63 | } 64 | 65 | - (void)placeSubviews 66 | { 67 | [super placeSubviews]; 68 | 69 | if (self.stateLabel.constraints.count) return; 70 | 71 | // 状态标签 72 | self.stateLabel.frame = self.bounds; 73 | } 74 | 75 | - (void)setState:(MJRefreshState)state 76 | { 77 | MJRefreshCheckState 78 | 79 | // 设置状态文字 80 | self.stateLabel.text = self.stateTitles[@(state)]; 81 | } 82 | @end 83 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshGifHeader.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshStateHeader.h" 10 | 11 | @interface MJRefreshGifHeader : MJRefreshStateHeader 12 | @property (weak, nonatomic, readonly) UIImageView *gifView; 13 | 14 | /** 设置state状态下的动画图片images 动画持续时间duration*/ 15 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state; 16 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state; 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshGifHeader.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshGifHeader.h" 10 | 11 | @interface MJRefreshGifHeader() 12 | { 13 | __unsafe_unretained UIImageView *_gifView; 14 | } 15 | /** 所有状态对应的动画图片 */ 16 | @property (strong, nonatomic) NSMutableDictionary *stateImages; 17 | /** 所有状态对应的动画时间 */ 18 | @property (strong, nonatomic) NSMutableDictionary *stateDurations; 19 | @end 20 | 21 | @implementation MJRefreshGifHeader 22 | #pragma mark - 懒加载 23 | - (UIImageView *)gifView 24 | { 25 | if (!_gifView) { 26 | UIImageView *gifView = [[UIImageView alloc] init]; 27 | [self addSubview:_gifView = gifView]; 28 | } 29 | return _gifView; 30 | } 31 | 32 | - (NSMutableDictionary *)stateImages 33 | { 34 | if (!_stateImages) { 35 | self.stateImages = [NSMutableDictionary dictionary]; 36 | } 37 | return _stateImages; 38 | } 39 | 40 | - (NSMutableDictionary *)stateDurations 41 | { 42 | if (!_stateDurations) { 43 | self.stateDurations = [NSMutableDictionary dictionary]; 44 | } 45 | return _stateDurations; 46 | } 47 | 48 | #pragma mark - 公共方法 49 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state 50 | { 51 | if (images == nil) return; 52 | 53 | self.stateImages[@(state)] = images; 54 | self.stateDurations[@(state)] = @(duration); 55 | 56 | /* 根据图片设置控件的高度 */ 57 | UIImage *image = [images firstObject]; 58 | if (image.size.height > self.mj_h) { 59 | self.mj_h = image.size.height; 60 | } 61 | } 62 | 63 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state 64 | { 65 | [self setImages:images duration:images.count * 0.1 forState:state]; 66 | } 67 | 68 | #pragma mark - 实现父类的方法 69 | - (void)prepare 70 | { 71 | [super prepare]; 72 | 73 | // 初始化间距 74 | self.labelLeftInset = 20; 75 | } 76 | 77 | - (void)setPullingPercent:(CGFloat)pullingPercent 78 | { 79 | [super setPullingPercent:pullingPercent]; 80 | NSArray *images = self.stateImages[@(MJRefreshStateIdle)]; 81 | if (self.state != MJRefreshStateIdle || images.count == 0) return; 82 | // 停止动画 83 | [self.gifView stopAnimating]; 84 | // 设置当前需要显示的图片 85 | NSUInteger index = images.count * pullingPercent; 86 | if (index >= images.count) index = images.count - 1; 87 | self.gifView.image = images[index]; 88 | } 89 | 90 | - (void)placeSubviews 91 | { 92 | [super placeSubviews]; 93 | 94 | if (self.gifView.constraints.count) return; 95 | 96 | self.gifView.frame = self.bounds; 97 | if (self.stateLabel.hidden && self.lastUpdatedTimeLabel.hidden) { 98 | self.gifView.contentMode = UIViewContentModeCenter; 99 | } else { 100 | self.gifView.contentMode = UIViewContentModeRight; 101 | 102 | CGFloat stateWidth = self.stateLabel.mj_textWith; 103 | CGFloat timeWidth = 0.0; 104 | if (!self.lastUpdatedTimeLabel.hidden) { 105 | timeWidth = self.lastUpdatedTimeLabel.mj_textWith; 106 | } 107 | CGFloat textWidth = MAX(stateWidth, timeWidth); 108 | self.gifView.mj_w = self.mj_w * 0.5 - textWidth * 0.5 - self.labelLeftInset; 109 | } 110 | } 111 | 112 | - (void)setState:(MJRefreshState)state 113 | { 114 | MJRefreshCheckState 115 | 116 | // 根据状态做事情 117 | if (state == MJRefreshStatePulling || state == MJRefreshStateRefreshing) { 118 | NSArray *images = self.stateImages[@(state)]; 119 | if (images.count == 0) return; 120 | 121 | [self.gifView stopAnimating]; 122 | if (images.count == 1) { // 单张图片 123 | self.gifView.image = [images lastObject]; 124 | } else { // 多张图片 125 | self.gifView.animationImages = images; 126 | self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue]; 127 | [self.gifView startAnimating]; 128 | } 129 | } else if (state == MJRefreshStateIdle) { 130 | [self.gifView stopAnimating]; 131 | } 132 | } 133 | @end 134 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshNormalHeader.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshStateHeader.h" 10 | 11 | @interface MJRefreshNormalHeader : MJRefreshStateHeader 12 | @property (weak, nonatomic, readonly) UIImageView *arrowView; 13 | /** 菊花的样式 */ 14 | @property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshNormalHeader.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshNormalHeader.h" 10 | #import "NSBundle+MJRefresh.h" 11 | 12 | @interface MJRefreshNormalHeader() 13 | { 14 | __unsafe_unretained UIImageView *_arrowView; 15 | } 16 | @property (weak, nonatomic) UIActivityIndicatorView *loadingView; 17 | @end 18 | 19 | @implementation MJRefreshNormalHeader 20 | #pragma mark - 懒加载子控件 21 | - (UIImageView *)arrowView 22 | { 23 | if (!_arrowView) { 24 | UIImageView *arrowView = [[UIImageView alloc] initWithImage:[NSBundle mj_arrowImage]]; 25 | [self addSubview:_arrowView = arrowView]; 26 | } 27 | return _arrowView; 28 | } 29 | 30 | - (UIActivityIndicatorView *)loadingView 31 | { 32 | if (!_loadingView) { 33 | UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:self.activityIndicatorViewStyle]; 34 | loadingView.hidesWhenStopped = YES; 35 | [self addSubview:_loadingView = loadingView]; 36 | } 37 | return _loadingView; 38 | } 39 | 40 | #pragma mark - 公共方法 41 | - (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle 42 | { 43 | _activityIndicatorViewStyle = activityIndicatorViewStyle; 44 | 45 | self.loadingView = nil; 46 | [self setNeedsLayout]; 47 | } 48 | 49 | #pragma mark - 重写父类的方法 50 | - (void)prepare 51 | { 52 | [super prepare]; 53 | 54 | self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 55 | } 56 | 57 | - (void)placeSubviews 58 | { 59 | [super placeSubviews]; 60 | 61 | // 箭头的中心点 62 | CGFloat arrowCenterX = self.mj_w * 0.5; 63 | if (!self.stateLabel.hidden) { 64 | CGFloat stateWidth = self.stateLabel.mj_textWith; 65 | CGFloat timeWidth = 0.0; 66 | if (!self.lastUpdatedTimeLabel.hidden) { 67 | timeWidth = self.lastUpdatedTimeLabel.mj_textWith; 68 | } 69 | CGFloat textWidth = MAX(stateWidth, timeWidth); 70 | arrowCenterX -= textWidth / 2 + self.labelLeftInset; 71 | } 72 | CGFloat arrowCenterY = self.mj_h * 0.5; 73 | CGPoint arrowCenter = CGPointMake(arrowCenterX, arrowCenterY); 74 | 75 | // 箭头 76 | if (self.arrowView.constraints.count == 0) { 77 | self.arrowView.mj_size = self.arrowView.image.size; 78 | self.arrowView.center = arrowCenter; 79 | } 80 | 81 | // 圈圈 82 | if (self.loadingView.constraints.count == 0) { 83 | self.loadingView.center = arrowCenter; 84 | } 85 | 86 | self.arrowView.tintColor = self.stateLabel.textColor; 87 | } 88 | 89 | - (void)setState:(MJRefreshState)state 90 | { 91 | MJRefreshCheckState 92 | 93 | // 根据状态做事情 94 | if (state == MJRefreshStateIdle) { 95 | if (oldState == MJRefreshStateRefreshing) { 96 | self.arrowView.transform = CGAffineTransformIdentity; 97 | 98 | [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ 99 | self.loadingView.alpha = 0.0; 100 | } completion:^(BOOL finished) { 101 | // 如果执行完动画发现不是idle状态,就直接返回,进入其他状态 102 | if (self.state != MJRefreshStateIdle) return; 103 | 104 | self.loadingView.alpha = 1.0; 105 | [self.loadingView stopAnimating]; 106 | self.arrowView.hidden = NO; 107 | }]; 108 | } else { 109 | [self.loadingView stopAnimating]; 110 | self.arrowView.hidden = NO; 111 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 112 | self.arrowView.transform = CGAffineTransformIdentity; 113 | }]; 114 | } 115 | } else if (state == MJRefreshStatePulling) { 116 | [self.loadingView stopAnimating]; 117 | self.arrowView.hidden = NO; 118 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 119 | self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI); 120 | }]; 121 | } else if (state == MJRefreshStateRefreshing) { 122 | self.loadingView.alpha = 1.0; // 防止refreshing -> idle的动画完毕动作没有被执行 123 | [self.loadingView startAnimating]; 124 | self.arrowView.hidden = YES; 125 | } 126 | } 127 | @end 128 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshStateHeader.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshHeader.h" 10 | 11 | @interface MJRefreshStateHeader : MJRefreshHeader 12 | #pragma mark - 刷新时间相关 13 | /** 利用这个block来决定显示的更新时间文字 */ 14 | @property (copy, nonatomic) NSString *(^lastUpdatedTimeText)(NSDate *lastUpdatedTime); 15 | /** 显示上一次刷新时间的label */ 16 | @property (weak, nonatomic, readonly) UILabel *lastUpdatedTimeLabel; 17 | 18 | #pragma mark - 状态相关 19 | /** 文字距离圈圈、箭头的距离 */ 20 | @property (assign, nonatomic) CGFloat labelLeftInset; 21 | /** 显示刷新状态的label */ 22 | @property (weak, nonatomic, readonly) UILabel *stateLabel; 23 | /** 设置state状态下的文字 */ 24 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state; 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/MJRefresh.bundle/arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongdong/HDTableViewMaker/c1d618e5fb4366b11490e983a7dde8acd4987c08/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/arrow@2x.png -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/MJRefresh.bundle/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongdong/HDTableViewMaker/c1d618e5fb4366b11490e983a7dde8acd4987c08/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/en.lproj/Localizable.strings -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/MJRefresh.bundle/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongdong/HDTableViewMaker/c1d618e5fb4366b11490e983a7dde8acd4987c08/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/zh-Hans.lproj/Localizable.strings -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/MJRefresh.bundle/zh-Hant.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "MJRefreshHeaderIdleText" = "下拉可以刷新"; 2 | "MJRefreshHeaderPullingText" = "鬆開立即刷新"; 3 | "MJRefreshHeaderRefreshingText" = "正在刷新數據中..."; 4 | 5 | "MJRefreshAutoFooterIdleText" = "點擊或上拉加載更多"; 6 | "MJRefreshAutoFooterRefreshingText" = "正在加載更多的數據..."; 7 | "MJRefreshAutoFooterNoMoreDataText" = "已經全部加載完畢"; 8 | 9 | "MJRefreshBackFooterIdleText" = "上拉可以加載更多"; 10 | "MJRefreshBackFooterPullingText" = "鬆開立即加載更多"; 11 | "MJRefreshBackFooterRefreshingText" = "正在加載更多的數據..."; 12 | "MJRefreshBackFooterNoMoreDataText" = "已經全部加載完畢"; 13 | 14 | "MJRefreshHeaderLastTimeText" = "最後更新:"; 15 | "MJRefreshHeaderDateTodayText" = "今天"; 16 | "MJRefreshHeaderNoneLastDateText" = "無記錄"; 17 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/MJRefresh.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | 4 | #import "UIScrollView+MJRefresh.h" 5 | #import "UIScrollView+MJExtension.h" 6 | #import "UIView+MJExtension.h" 7 | 8 | #import "MJRefreshNormalHeader.h" 9 | #import "MJRefreshGifHeader.h" 10 | 11 | #import "MJRefreshBackNormalFooter.h" 12 | #import "MJRefreshBackGifFooter.h" 13 | #import "MJRefreshAutoNormalFooter.h" 14 | #import "MJRefreshAutoGifFooter.h" -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/MJRefreshConst.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | #import 4 | #import 5 | 6 | // 弱引用 7 | #define MJWeakSelf __weak typeof(self) weakSelf = self; 8 | 9 | // 日志输出 10 | #ifdef DEBUG 11 | #define MJRefreshLog(...) NSLog(__VA_ARGS__) 12 | #else 13 | #define MJRefreshLog(...) 14 | #endif 15 | 16 | // 过期提醒 17 | #define MJRefreshDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead) 18 | 19 | // 运行时objc_msgSend 20 | #define MJRefreshMsgSend(...) ((void (*)(void *, SEL, UIView *))objc_msgSend)(__VA_ARGS__) 21 | #define MJRefreshMsgTarget(target) (__bridge void *)(target) 22 | 23 | // RGB颜色 24 | #define MJRefreshColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] 25 | 26 | // 文字颜色 27 | #define MJRefreshLabelTextColor MJRefreshColor(90, 90, 90) 28 | 29 | // 字体大小 30 | #define MJRefreshLabelFont [UIFont boldSystemFontOfSize:14] 31 | 32 | // 常量 33 | UIKIT_EXTERN const CGFloat MJRefreshLabelLeftInset; 34 | UIKIT_EXTERN const CGFloat MJRefreshHeaderHeight; 35 | UIKIT_EXTERN const CGFloat MJRefreshFooterHeight; 36 | UIKIT_EXTERN const CGFloat MJRefreshFastAnimationDuration; 37 | UIKIT_EXTERN const CGFloat MJRefreshSlowAnimationDuration; 38 | 39 | UIKIT_EXTERN NSString *const MJRefreshKeyPathContentOffset; 40 | UIKIT_EXTERN NSString *const MJRefreshKeyPathContentSize; 41 | UIKIT_EXTERN NSString *const MJRefreshKeyPathContentInset; 42 | UIKIT_EXTERN NSString *const MJRefreshKeyPathPanState; 43 | 44 | UIKIT_EXTERN NSString *const MJRefreshHeaderLastUpdatedTimeKey; 45 | 46 | UIKIT_EXTERN NSString *const MJRefreshHeaderIdleText; 47 | UIKIT_EXTERN NSString *const MJRefreshHeaderPullingText; 48 | UIKIT_EXTERN NSString *const MJRefreshHeaderRefreshingText; 49 | 50 | UIKIT_EXTERN NSString *const MJRefreshAutoFooterIdleText; 51 | UIKIT_EXTERN NSString *const MJRefreshAutoFooterRefreshingText; 52 | UIKIT_EXTERN NSString *const MJRefreshAutoFooterNoMoreDataText; 53 | 54 | UIKIT_EXTERN NSString *const MJRefreshBackFooterIdleText; 55 | UIKIT_EXTERN NSString *const MJRefreshBackFooterPullingText; 56 | UIKIT_EXTERN NSString *const MJRefreshBackFooterRefreshingText; 57 | UIKIT_EXTERN NSString *const MJRefreshBackFooterNoMoreDataText; 58 | 59 | UIKIT_EXTERN NSString *const MJRefreshHeaderLastTimeText; 60 | UIKIT_EXTERN NSString *const MJRefreshHeaderDateTodayText; 61 | UIKIT_EXTERN NSString *const MJRefreshHeaderNoneLastDateText; 62 | 63 | // 状态检查 64 | #define MJRefreshCheckState \ 65 | MJRefreshState oldState = self.state; \ 66 | if (state == oldState) return; \ 67 | [super setState:state]; 68 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/MJRefreshConst.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | #import 4 | 5 | const CGFloat MJRefreshLabelLeftInset = 25; 6 | const CGFloat MJRefreshHeaderHeight = 54.0; 7 | const CGFloat MJRefreshFooterHeight = 44.0; 8 | const CGFloat MJRefreshFastAnimationDuration = 0.25; 9 | const CGFloat MJRefreshSlowAnimationDuration = 0.4; 10 | 11 | NSString *const MJRefreshKeyPathContentOffset = @"contentOffset"; 12 | NSString *const MJRefreshKeyPathContentInset = @"contentInset"; 13 | NSString *const MJRefreshKeyPathContentSize = @"contentSize"; 14 | NSString *const MJRefreshKeyPathPanState = @"state"; 15 | 16 | NSString *const MJRefreshHeaderLastUpdatedTimeKey = @"MJRefreshHeaderLastUpdatedTimeKey"; 17 | 18 | NSString *const MJRefreshHeaderIdleText = @"MJRefreshHeaderIdleText"; 19 | NSString *const MJRefreshHeaderPullingText = @"MJRefreshHeaderPullingText"; 20 | NSString *const MJRefreshHeaderRefreshingText = @"MJRefreshHeaderRefreshingText"; 21 | 22 | NSString *const MJRefreshAutoFooterIdleText = @"MJRefreshAutoFooterIdleText"; 23 | NSString *const MJRefreshAutoFooterRefreshingText = @"MJRefreshAutoFooterRefreshingText"; 24 | NSString *const MJRefreshAutoFooterNoMoreDataText = @"MJRefreshAutoFooterNoMoreDataText"; 25 | 26 | NSString *const MJRefreshBackFooterIdleText = @"MJRefreshBackFooterIdleText"; 27 | NSString *const MJRefreshBackFooterPullingText = @"MJRefreshBackFooterPullingText"; 28 | NSString *const MJRefreshBackFooterRefreshingText = @"MJRefreshBackFooterRefreshingText"; 29 | NSString *const MJRefreshBackFooterNoMoreDataText = @"MJRefreshBackFooterNoMoreDataText"; 30 | 31 | NSString *const MJRefreshHeaderLastTimeText = @"MJRefreshHeaderLastTimeText"; 32 | NSString *const MJRefreshHeaderDateTodayText = @"MJRefreshHeaderDateTodayText"; 33 | NSString *const MJRefreshHeaderNoneLastDateText = @"MJRefreshHeaderNoneLastDateText"; -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/NSBundle+MJRefresh.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+MJRefresh.h 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 16/6/13. 6 | // Copyright © 2016年 小码哥. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSBundle (MJRefresh) 12 | + (instancetype)mj_refreshBundle; 13 | + (UIImage *)mj_arrowImage; 14 | + (NSString *)mj_localizedStringForKey:(NSString *)key value:(NSString *)value; 15 | + (NSString *)mj_localizedStringForKey:(NSString *)key; 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/NSBundle+MJRefresh.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+MJRefresh.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 16/6/13. 6 | // Copyright © 2016年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "NSBundle+MJRefresh.h" 10 | #import "MJRefreshComponent.h" 11 | 12 | @implementation NSBundle (MJRefresh) 13 | + (instancetype)mj_refreshBundle 14 | { 15 | static NSBundle *refreshBundle = nil; 16 | if (refreshBundle == nil) { 17 | // 这里不使用mainBundle是为了适配pod 1.x和0.x 18 | refreshBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[MJRefreshComponent class]] pathForResource:@"MJRefresh" ofType:@"bundle"]]; 19 | } 20 | return refreshBundle; 21 | } 22 | 23 | + (UIImage *)mj_arrowImage 24 | { 25 | static UIImage *arrowImage = nil; 26 | if (arrowImage == nil) { 27 | arrowImage = [[UIImage imageWithContentsOfFile:[[self mj_refreshBundle] pathForResource:@"arrow@2x" ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 28 | } 29 | return arrowImage; 30 | } 31 | 32 | + (NSString *)mj_localizedStringForKey:(NSString *)key 33 | { 34 | return [self mj_localizedStringForKey:key value:nil]; 35 | } 36 | 37 | + (NSString *)mj_localizedStringForKey:(NSString *)key value:(NSString *)value 38 | { 39 | static NSBundle *bundle = nil; 40 | if (bundle == nil) { 41 | // (iOS获取的语言字符串比较不稳定)目前框架只处理en、zh-Hans、zh-Hant三种情况,其他按照系统默认处理 42 | NSString *language = [NSLocale preferredLanguages].firstObject; 43 | if ([language hasPrefix:@"en"]) { 44 | language = @"en"; 45 | } else if ([language hasPrefix:@"zh"]) { 46 | if ([language rangeOfString:@"Hans"].location != NSNotFound) { 47 | language = @"zh-Hans"; // 简体中文 48 | } else { // zh-Hant\zh-HK\zh-TW 49 | language = @"zh-Hant"; // 繁體中文 50 | } 51 | } else { 52 | language = @"en"; 53 | } 54 | 55 | // 从MJRefresh.bundle中查找资源 56 | bundle = [NSBundle bundleWithPath:[[NSBundle mj_refreshBundle] pathForResource:language ofType:@"lproj"]]; 57 | } 58 | value = [bundle localizedStringForKey:key value:value table:nil]; 59 | return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil]; 60 | } 61 | @end 62 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/UIScrollView+MJExtension.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // UIScrollView+Extension.h 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 14-5-28. 7 | // Copyright (c) 2014年 小码哥. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface UIScrollView (MJExtension) 13 | @property (readonly, nonatomic) UIEdgeInsets mj_inset; 14 | 15 | @property (assign, nonatomic) CGFloat mj_insetT; 16 | @property (assign, nonatomic) CGFloat mj_insetB; 17 | @property (assign, nonatomic) CGFloat mj_insetL; 18 | @property (assign, nonatomic) CGFloat mj_insetR; 19 | 20 | @property (assign, nonatomic) CGFloat mj_offsetX; 21 | @property (assign, nonatomic) CGFloat mj_offsetY; 22 | 23 | @property (assign, nonatomic) CGFloat mj_contentW; 24 | @property (assign, nonatomic) CGFloat mj_contentH; 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/UIScrollView+MJExtension.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // UIScrollView+Extension.m 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 14-5-28. 7 | // Copyright (c) 2014年 小码哥. All rights reserved. 8 | // 9 | 10 | #import "UIScrollView+MJExtension.h" 11 | #import 12 | 13 | #define SYSTEM_VERSION_GREATER_NOT_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) 14 | 15 | #pragma clang diagnostic push 16 | #pragma clang diagnostic ignored "-Wunguarded-availability-new" 17 | 18 | @implementation UIScrollView (MJExtension) 19 | 20 | - (UIEdgeInsets)mj_inset 21 | { 22 | #ifdef __IPHONE_11_0 23 | if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { 24 | return self.adjustedContentInset; 25 | } 26 | #endif 27 | return self.contentInset; 28 | } 29 | 30 | - (void)setMj_insetT:(CGFloat)mj_insetT 31 | { 32 | UIEdgeInsets inset = self.contentInset; 33 | inset.top = mj_insetT; 34 | #ifdef __IPHONE_11_0 35 | if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { 36 | inset.top -= (self.adjustedContentInset.top - self.contentInset.top); 37 | } 38 | #endif 39 | self.contentInset = inset; 40 | } 41 | 42 | - (CGFloat)mj_insetT 43 | { 44 | return self.mj_inset.top; 45 | } 46 | 47 | - (void)setMj_insetB:(CGFloat)mj_insetB 48 | { 49 | UIEdgeInsets inset = self.contentInset; 50 | inset.bottom = mj_insetB; 51 | #ifdef __IPHONE_11_0 52 | if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { 53 | inset.bottom -= (self.adjustedContentInset.bottom - self.contentInset.bottom); 54 | } 55 | #endif 56 | self.contentInset = inset; 57 | } 58 | 59 | - (CGFloat)mj_insetB 60 | { 61 | return self.mj_inset.bottom; 62 | } 63 | 64 | - (void)setMj_insetL:(CGFloat)mj_insetL 65 | { 66 | UIEdgeInsets inset = self.contentInset; 67 | inset.left = mj_insetL; 68 | #ifdef __IPHONE_11_0 69 | if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { 70 | inset.left -= (self.adjustedContentInset.left - self.contentInset.left); 71 | } 72 | #endif 73 | self.contentInset = inset; 74 | } 75 | 76 | - (CGFloat)mj_insetL 77 | { 78 | return self.mj_inset.left; 79 | } 80 | 81 | - (void)setMj_insetR:(CGFloat)mj_insetR 82 | { 83 | UIEdgeInsets inset = self.contentInset; 84 | inset.right = mj_insetR; 85 | #ifdef __IPHONE_11_0 86 | if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { 87 | inset.right -= (self.adjustedContentInset.right - self.contentInset.right); 88 | } 89 | #endif 90 | self.contentInset = inset; 91 | } 92 | 93 | - (CGFloat)mj_insetR 94 | { 95 | return self.mj_inset.right; 96 | } 97 | 98 | - (void)setMj_offsetX:(CGFloat)mj_offsetX 99 | { 100 | CGPoint offset = self.contentOffset; 101 | offset.x = mj_offsetX; 102 | self.contentOffset = offset; 103 | } 104 | 105 | - (CGFloat)mj_offsetX 106 | { 107 | return self.contentOffset.x; 108 | } 109 | 110 | - (void)setMj_offsetY:(CGFloat)mj_offsetY 111 | { 112 | CGPoint offset = self.contentOffset; 113 | offset.y = mj_offsetY; 114 | self.contentOffset = offset; 115 | } 116 | 117 | - (CGFloat)mj_offsetY 118 | { 119 | return self.contentOffset.y; 120 | } 121 | 122 | - (void)setMj_contentW:(CGFloat)mj_contentW 123 | { 124 | CGSize size = self.contentSize; 125 | size.width = mj_contentW; 126 | self.contentSize = size; 127 | } 128 | 129 | - (CGFloat)mj_contentW 130 | { 131 | return self.contentSize.width; 132 | } 133 | 134 | - (void)setMj_contentH:(CGFloat)mj_contentH 135 | { 136 | CGSize size = self.contentSize; 137 | size.height = mj_contentH; 138 | self.contentSize = size; 139 | } 140 | 141 | - (CGFloat)mj_contentH 142 | { 143 | return self.contentSize.height; 144 | } 145 | @end 146 | #pragma clang diagnostic pop 147 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/UIScrollView+MJRefresh.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // UIScrollView+MJRefresh.h 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 15/3/4. 7 | // Copyright (c) 2015年 小码哥. All rights reserved. 8 | // 给ScrollView增加下拉刷新、上拉刷新的功能 9 | 10 | #import 11 | #import "MJRefreshConst.h" 12 | 13 | @class MJRefreshHeader, MJRefreshFooter; 14 | 15 | @interface UIScrollView (MJRefresh) 16 | /** 下拉刷新控件 */ 17 | @property (strong, nonatomic) MJRefreshHeader *mj_header; 18 | @property (strong, nonatomic) MJRefreshHeader *header MJRefreshDeprecated("使用mj_header"); 19 | /** 上拉刷新控件 */ 20 | @property (strong, nonatomic) MJRefreshFooter *mj_footer; 21 | @property (strong, nonatomic) MJRefreshFooter *footer MJRefreshDeprecated("使用mj_footer"); 22 | 23 | #pragma mark - other 24 | - (NSInteger)mj_totalDataCount; 25 | @property (copy, nonatomic) void (^mj_reloadDataBlock)(NSInteger totalDataCount); 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/UIScrollView+MJRefresh.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // UIScrollView+MJRefresh.m 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 15/3/4. 7 | // Copyright (c) 2015年 小码哥. All rights reserved. 8 | // 9 | 10 | #import "UIScrollView+MJRefresh.h" 11 | #import "MJRefreshHeader.h" 12 | #import "MJRefreshFooter.h" 13 | #import 14 | 15 | @implementation NSObject (MJRefresh) 16 | 17 | + (void)exchangeInstanceMethod1:(SEL)method1 method2:(SEL)method2 18 | { 19 | method_exchangeImplementations(class_getInstanceMethod(self, method1), class_getInstanceMethod(self, method2)); 20 | } 21 | 22 | + (void)exchangeClassMethod1:(SEL)method1 method2:(SEL)method2 23 | { 24 | method_exchangeImplementations(class_getClassMethod(self, method1), class_getClassMethod(self, method2)); 25 | } 26 | 27 | @end 28 | 29 | @implementation UIScrollView (MJRefresh) 30 | 31 | #pragma mark - header 32 | static const char MJRefreshHeaderKey = '\0'; 33 | - (void)setMj_header:(MJRefreshHeader *)mj_header 34 | { 35 | if (mj_header != self.mj_header) { 36 | // 删除旧的,添加新的 37 | [self.mj_header removeFromSuperview]; 38 | [self insertSubview:mj_header atIndex:0]; 39 | 40 | // 存储新的 41 | [self willChangeValueForKey:@"mj_header"]; // KVO 42 | objc_setAssociatedObject(self, &MJRefreshHeaderKey, 43 | mj_header, OBJC_ASSOCIATION_ASSIGN); 44 | [self didChangeValueForKey:@"mj_header"]; // KVO 45 | } 46 | } 47 | 48 | - (MJRefreshHeader *)mj_header 49 | { 50 | return objc_getAssociatedObject(self, &MJRefreshHeaderKey); 51 | } 52 | 53 | #pragma mark - footer 54 | static const char MJRefreshFooterKey = '\0'; 55 | - (void)setMj_footer:(MJRefreshFooter *)mj_footer 56 | { 57 | if (mj_footer != self.mj_footer) { 58 | // 删除旧的,添加新的 59 | [self.mj_footer removeFromSuperview]; 60 | [self insertSubview:mj_footer atIndex:0]; 61 | 62 | // 存储新的 63 | [self willChangeValueForKey:@"mj_footer"]; // KVO 64 | objc_setAssociatedObject(self, &MJRefreshFooterKey, 65 | mj_footer, OBJC_ASSOCIATION_ASSIGN); 66 | [self didChangeValueForKey:@"mj_footer"]; // KVO 67 | } 68 | } 69 | 70 | - (MJRefreshFooter *)mj_footer 71 | { 72 | return objc_getAssociatedObject(self, &MJRefreshFooterKey); 73 | } 74 | 75 | #pragma mark - 过期 76 | - (void)setFooter:(MJRefreshFooter *)footer 77 | { 78 | self.mj_footer = footer; 79 | } 80 | 81 | - (MJRefreshFooter *)footer 82 | { 83 | return self.mj_footer; 84 | } 85 | 86 | - (void)setHeader:(MJRefreshHeader *)header 87 | { 88 | self.mj_header = header; 89 | } 90 | 91 | - (MJRefreshHeader *)header 92 | { 93 | return self.mj_header; 94 | } 95 | 96 | #pragma mark - other 97 | - (NSInteger)mj_totalDataCount 98 | { 99 | NSInteger totalCount = 0; 100 | if ([self isKindOfClass:[UITableView class]]) { 101 | UITableView *tableView = (UITableView *)self; 102 | 103 | for (NSInteger section = 0; section 11 | 12 | @interface UIView (MJExtension) 13 | @property (assign, nonatomic) CGFloat mj_x; 14 | @property (assign, nonatomic) CGFloat mj_y; 15 | @property (assign, nonatomic) CGFloat mj_w; 16 | @property (assign, nonatomic) CGFloat mj_h; 17 | @property (assign, nonatomic) CGSize mj_size; 18 | @property (assign, nonatomic) CGPoint mj_origin; 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/MJRefresh/MJRefresh/UIView+MJExtension.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh 2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 3 | // UIView+Extension.m 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 14-5-28. 7 | // Copyright (c) 2014年 小码哥. All rights reserved. 8 | // 9 | 10 | #import "UIView+MJExtension.h" 11 | 12 | @implementation UIView (MJExtension) 13 | - (void)setMj_x:(CGFloat)mj_x 14 | { 15 | CGRect frame = self.frame; 16 | frame.origin.x = mj_x; 17 | self.frame = frame; 18 | } 19 | 20 | - (CGFloat)mj_x 21 | { 22 | return self.frame.origin.x; 23 | } 24 | 25 | - (void)setMj_y:(CGFloat)mj_y 26 | { 27 | CGRect frame = self.frame; 28 | frame.origin.y = mj_y; 29 | self.frame = frame; 30 | } 31 | 32 | - (CGFloat)mj_y 33 | { 34 | return self.frame.origin.y; 35 | } 36 | 37 | - (void)setMj_w:(CGFloat)mj_w 38 | { 39 | CGRect frame = self.frame; 40 | frame.size.width = mj_w; 41 | self.frame = frame; 42 | } 43 | 44 | - (CGFloat)mj_w 45 | { 46 | return self.frame.size.width; 47 | } 48 | 49 | - (void)setMj_h:(CGFloat)mj_h 50 | { 51 | CGRect frame = self.frame; 52 | frame.size.height = mj_h; 53 | self.frame = frame; 54 | } 55 | 56 | - (CGFloat)mj_h 57 | { 58 | return self.frame.size.height; 59 | } 60 | 61 | - (void)setMj_size:(CGSize)mj_size 62 | { 63 | CGRect frame = self.frame; 64 | frame.size = mj_size; 65 | self.frame = frame; 66 | } 67 | 68 | - (CGSize)mj_size 69 | { 70 | return self.frame.size; 71 | } 72 | 73 | - (void)setMj_origin:(CGPoint)mj_origin 74 | { 75 | CGRect frame = self.frame; 76 | frame.origin = mj_origin; 77 | self.frame = frame; 78 | } 79 | 80 | - (CGPoint)mj_origin 81 | { 82 | return self.frame.origin; 83 | } 84 | @end 85 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Masonry (1.1.0) 3 | - MJRefresh (3.1.15) 4 | - UITableView+FDTemplateLayoutCell (1.6) 5 | 6 | DEPENDENCIES: 7 | - Masonry 8 | - MJRefresh 9 | - UITableView+FDTemplateLayoutCell 10 | 11 | SPEC CHECKSUMS: 12 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 13 | MJRefresh: 9af70f5f9327a2cf87f0fb5929f35fcc2fa638ea 14 | UITableView+FDTemplateLayoutCell: 5c949b4a5059c404b442926c0e80f81d10a2d66f 15 | 16 | PODFILE CHECKSUM: 816f0f1b306568c869714081d9f2fdc574921d57 17 | 18 | COCOAPODS: 1.3.1 19 | -------------------------------------------------------------------------------- /Pods/Masonry/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 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. -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | /** 13 | * A group of MASConstraint objects 14 | */ 15 | @interface MASCompositeConstraint : MASConstraint 16 | 17 | /** 18 | * Creates a composite with a predefined array of children 19 | * 20 | * @param children child MASConstraints 21 | * 22 | * @return a composite constraint 23 | */ 24 | - (id)initWithChildren:(NSArray *)children; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint+Private.h 3 | // Masonry 4 | // 5 | // Created by Nick Tymchenko on 29/04/14. 6 | // Copyright (c) 2014 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | 11 | @protocol MASConstraintDelegate; 12 | 13 | 14 | @interface MASConstraint () 15 | 16 | /** 17 | * Whether or not to check for an existing constraint instead of adding constraint 18 | */ 19 | @property (nonatomic, assign) BOOL updateExisting; 20 | 21 | /** 22 | * Usually MASConstraintMaker but could be a parent MASConstraint 23 | */ 24 | @property (nonatomic, weak) id delegate; 25 | 26 | /** 27 | * Based on a provided value type, is equal to calling: 28 | * NSNumber - setOffset: 29 | * NSValue with CGPoint - setPointOffset: 30 | * NSValue with CGSize - setSizeOffset: 31 | * NSValue with MASEdgeInsets - setInsets: 32 | */ 33 | - (void)setLayoutConstantWithValue:(NSValue *)value; 34 | 35 | @end 36 | 37 | 38 | @interface MASConstraint (Abstract) 39 | 40 | /** 41 | * Sets the constraint relation to given NSLayoutRelation 42 | * returns a block which accepts one of the following: 43 | * MASViewAttribute, UIView, NSValue, NSArray 44 | * see readme for more details. 45 | */ 46 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation; 47 | 48 | /** 49 | * Override to set a custom chaining behaviour 50 | */ 51 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 52 | 53 | @end 54 | 55 | 56 | @protocol MASConstraintDelegate 57 | 58 | /** 59 | * Notifies the delegate when the constraint needs to be replaced with another constraint. For example 60 | * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks 61 | */ 62 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint; 63 | 64 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * When you are debugging or printing the constraints attached to a view this subclass 13 | * makes it easier to identify which constraints have been created via Masonry 14 | */ 15 | @interface MASLayoutConstraint : NSLayoutConstraint 16 | 17 | /** 18 | * a key to associate with this constraint 19 | */ 20 | @property (nonatomic, strong) id mas_key; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASLayoutConstraint.h" 10 | 11 | @implementation MASLayoutConstraint 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * An immutable tuple which stores the view and the related NSLayoutAttribute. 13 | * Describes part of either the left or right hand side of a constraint equation 14 | */ 15 | @interface MASViewAttribute : NSObject 16 | 17 | /** 18 | * The view which the reciever relates to. Can be nil if item is not a view. 19 | */ 20 | @property (nonatomic, weak, readonly) MAS_VIEW *view; 21 | 22 | /** 23 | * The item which the reciever relates to. 24 | */ 25 | @property (nonatomic, weak, readonly) id item; 26 | 27 | /** 28 | * The attribute which the reciever relates to 29 | */ 30 | @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute; 31 | 32 | /** 33 | * Convenience initializer. 34 | */ 35 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; 36 | 37 | /** 38 | * The designated initializer. 39 | */ 40 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; 41 | 42 | /** 43 | * Determine whether the layoutAttribute is a size attribute 44 | * 45 | * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight 46 | */ 47 | - (BOOL)isSizeAttribute; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | 11 | @implementation MASViewAttribute 12 | 13 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute { 14 | self = [self initWithView:view item:view layoutAttribute:layoutAttribute]; 15 | return self; 16 | } 17 | 18 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute { 19 | self = [super init]; 20 | if (!self) return nil; 21 | 22 | _view = view; 23 | _item = item; 24 | _layoutAttribute = layoutAttribute; 25 | 26 | return self; 27 | } 28 | 29 | - (BOOL)isSizeAttribute { 30 | return self.layoutAttribute == NSLayoutAttributeWidth 31 | || self.layoutAttribute == NSLayoutAttributeHeight; 32 | } 33 | 34 | - (BOOL)isEqual:(MASViewAttribute *)viewAttribute { 35 | if ([viewAttribute isKindOfClass:self.class]) { 36 | return self.view == viewAttribute.view 37 | && self.layoutAttribute == viewAttribute.layoutAttribute; 38 | } 39 | return [super isEqual:viewAttribute]; 40 | } 41 | 42 | - (NSUInteger)hash { 43 | return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | #import "MASUtilities.h" 13 | 14 | /** 15 | * A single constraint. 16 | * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view 17 | */ 18 | @interface MASViewConstraint : MASConstraint 19 | 20 | /** 21 | * First item/view and first attribute of the NSLayoutConstraint 22 | */ 23 | @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute; 24 | 25 | /** 26 | * Second item/view and second attribute of the NSLayoutConstraint 27 | */ 28 | @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute; 29 | 30 | /** 31 | * initialises the MASViewConstraint with the first part of the equation 32 | * 33 | * @param firstViewAttribute view.mas_left, view.mas_width etc. 34 | * 35 | * @return a new view constraint 36 | */ 37 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute; 38 | 39 | /** 40 | * Returns all MASViewConstraints installed with this view as a first item. 41 | * 42 | * @param view A view to retrieve constraints for. 43 | * 44 | * @return An array of MASViewConstraints. 45 | */ 46 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Masonry.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Masonry. 12 | FOUNDATION_EXPORT double MasonryVersionNumber; 13 | 14 | //! Project version string for Masonry. 15 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 16 | 17 | #import "MASUtilities.h" 18 | #import "View+MASAdditions.h" 19 | #import "View+MASShorthandAdditions.h" 20 | #import "ViewController+MASAdditions.h" 21 | #import "NSArray+MASAdditions.h" 22 | #import "NSArray+MASShorthandAdditions.h" 23 | #import "MASConstraint.h" 24 | #import "MASCompositeConstraint.h" 25 | #import "MASViewAttribute.h" 26 | #import "MASViewConstraint.h" 27 | #import "MASConstraintMaker.h" 28 | #import "MASLayoutConstraint.h" 29 | #import "NSLayoutConstraint+MASDebugAdditions.h" 30 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.h 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | typedef NS_ENUM(NSUInteger, MASAxisType) { 14 | MASAxisTypeHorizontal, 15 | MASAxisTypeVertical 16 | }; 17 | 18 | @interface NSArray (MASAdditions) 19 | 20 | /** 21 | * Creates a MASConstraintMaker with each view in the callee. 22 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view 23 | * 24 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 25 | * 26 | * @return Array of created MASConstraints 27 | */ 28 | - (NSArray *)mas_makeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 29 | 30 | /** 31 | * Creates a MASConstraintMaker with each view in the callee. 32 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 33 | * If an existing constraint exists then it will be updated instead. 34 | * 35 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 36 | * 37 | * @return Array of created/updated MASConstraints 38 | */ 39 | - (NSArray *)mas_updateConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 40 | 41 | /** 42 | * Creates a MASConstraintMaker with each view in the callee. 43 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 44 | * All constraints previously installed for the views will be removed. 45 | * 46 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 47 | * 48 | * @return Array of created/updated MASConstraints 49 | */ 50 | - (NSArray *)mas_remakeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 51 | 52 | /** 53 | * distribute with fixed spacing 54 | * 55 | * @param axisType which axis to distribute items along 56 | * @param fixedSpacing the spacing between each item 57 | * @param leadSpacing the spacing before the first item and the container 58 | * @param tailSpacing the spacing after the last item and the container 59 | */ 60 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 61 | 62 | /** 63 | * distribute with fixed item size 64 | * 65 | * @param axisType which axis to distribute items along 66 | * @param fixedItemLength the fixed length of each item 67 | * @param leadSpacing the spacing before the first item and the container 68 | * @param tailSpacing the spacing after the last item and the container 69 | */ 70 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand array additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface NSArray (MASShorthandAdditions) 18 | 19 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 20 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 21 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 22 | 23 | @end 24 | 25 | @implementation NSArray (MASShorthandAdditions) 26 | 27 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 28 | return [self mas_makeConstraints:block]; 29 | } 30 | 31 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 32 | return [self mas_updateConstraints:block]; 33 | } 34 | 35 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 36 | return [self mas_remakeConstraints:block]; 37 | } 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * makes debug and log output of NSLayoutConstraints more readable 13 | */ 14 | @interface NSLayoutConstraint (MASDebugAdditions) 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | #ifdef MAS_VIEW_CONTROLLER 14 | 15 | @interface MAS_VIEW_CONTROLLER (MASAdditions) 16 | 17 | /** 18 | * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute 19 | */ 20 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom; 26 | 27 | 28 | @end 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "ViewController+MASAdditions.h" 10 | 11 | #ifdef MAS_VIEW_CONTROLLER 12 | 13 | @implementation MAS_VIEW_CONTROLLER (MASAdditions) 14 | 15 | - (MASViewAttribute *)mas_topLayoutGuide { 16 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 17 | } 18 | - (MASViewAttribute *)mas_topLayoutGuideTop { 19 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 20 | } 21 | - (MASViewAttribute *)mas_topLayoutGuideBottom { 22 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 23 | } 24 | 25 | - (MASViewAttribute *)mas_bottomLayoutGuide { 26 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 27 | } 28 | - (MASViewAttribute *)mas_bottomLayoutGuideTop { 29 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 30 | } 31 | - (MASViewAttribute *)mas_bottomLayoutGuideBottom { 32 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 33 | } 34 | 35 | 36 | 37 | @end 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/Abner.xcuserdatad/xcschemes/UITableView+FDTemplateLayoutCell.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/Abner.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MJRefresh.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Masonry.xcscheme 13 | 14 | isShown 15 | 16 | 17 | Pods-HDTableViewMakerDemo.xcscheme 18 | 19 | isShown 20 | 21 | 22 | UITableView+FDTemplateLayoutCell.xcscheme 23 | 24 | isShown 25 | 26 | 27 | 28 | SuppressBuildableAutocreation 29 | 30 | 401F78C3071223A1B230E91B28C76333 31 | 32 | primary 33 | 34 | 35 | 53480ED0BE09FF49E34B1702D485CAAB 36 | 37 | primary 38 | 39 | 40 | 70BC44266C6FFE30D2C57129458E070B 41 | 42 | primary 43 | 44 | 45 | B8679B5E750709D1B546C9A397E4E8BD 46 | 47 | primary 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MJRefresh/MJRefresh-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_MJRefresh : NSObject 3 | @end 4 | @implementation PodsDummy_MJRefresh 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MJRefresh/MJRefresh-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MJRefresh/MJRefresh.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/MJRefresh 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MJRefresh" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/UITableView+FDTemplateLayoutCell" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/MJRefresh 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Masonry : NSObject 3 | @end 4 | @implementation PodsDummy_Masonry 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Masonry 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Masonry" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/UITableView+FDTemplateLayoutCell" 4 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Masonry 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HDTableViewMakerDemo/Pods-HDTableViewMakerDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## MJRefresh 5 | 6 | Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## Masonry 28 | 29 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy 32 | of this software and associated documentation files (the "Software"), to deal 33 | in the Software without restriction, including without limitation the rights 34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 35 | copies of the Software, and to permit persons to whom the Software is 36 | furnished to do so, subject to the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be included in 39 | all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 47 | THE SOFTWARE. 48 | 49 | ## UITableView+FDTemplateLayoutCell 50 | 51 | The MIT License (MIT) 52 | 53 | Copyright (c) 2015 54 | 55 | Permission is hereby granted, free of charge, to any person obtaining a copy 56 | of this software and associated documentation files (the "Software"), to deal 57 | in the Software without restriction, including without limitation the rights 58 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 59 | copies of the Software, and to permit persons to whom the Software is 60 | furnished to do so, subject to the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included in all 63 | copies or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 66 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 67 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 68 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 69 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 70 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 71 | SOFTWARE. 72 | 73 | 74 | Generated by CocoaPods - https://cocoapods.org 75 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HDTableViewMakerDemo/Pods-HDTableViewMakerDemo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh) 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | MJRefresh 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is 53 | furnished to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in 56 | all copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | License 66 | MIT 67 | Title 68 | Masonry 69 | Type 70 | PSGroupSpecifier 71 | 72 | 73 | FooterText 74 | The MIT License (MIT) 75 | 76 | Copyright (c) 2015 77 | 78 | Permission is hereby granted, free of charge, to any person obtaining a copy 79 | of this software and associated documentation files (the "Software"), to deal 80 | in the Software without restriction, including without limitation the rights 81 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 82 | copies of the Software, and to permit persons to whom the Software is 83 | furnished to do so, subject to the following conditions: 84 | 85 | The above copyright notice and this permission notice shall be included in all 86 | copies or substantial portions of the Software. 87 | 88 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 89 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 90 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 91 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 92 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 93 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 94 | SOFTWARE. 95 | 96 | 97 | License 98 | MIT 99 | Title 100 | UITableView+FDTemplateLayoutCell 101 | Type 102 | PSGroupSpecifier 103 | 104 | 105 | FooterText 106 | Generated by CocoaPods - https://cocoapods.org 107 | Title 108 | 109 | Type 110 | PSGroupSpecifier 111 | 112 | 113 | StringsTable 114 | Acknowledgements 115 | Title 116 | Acknowledgements 117 | 118 | 119 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HDTableViewMakerDemo/Pods-HDTableViewMakerDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_HDTableViewMakerDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_HDTableViewMakerDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HDTableViewMakerDemo/Pods-HDTableViewMakerDemo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 10 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 11 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 12 | 13 | install_framework() 14 | { 15 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 16 | local source="${BUILT_PRODUCTS_DIR}/$1" 17 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 18 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 19 | elif [ -r "$1" ]; then 20 | local source="$1" 21 | fi 22 | 23 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 24 | 25 | if [ -L "${source}" ]; then 26 | echo "Symlinked..." 27 | source="$(readlink "${source}")" 28 | fi 29 | 30 | # Use filter instead of exclude so missing patterns don't throw errors. 31 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 32 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 33 | 34 | local basename 35 | basename="$(basename -s .framework "$1")" 36 | binary="${destination}/${basename}.framework/${basename}" 37 | if ! [ -r "$binary" ]; then 38 | binary="${destination}/${basename}" 39 | fi 40 | 41 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 42 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 43 | strip_invalid_archs "$binary" 44 | fi 45 | 46 | # Resign the code if required by the build settings to avoid unstable apps 47 | code_sign_if_enabled "${destination}/$(basename "$1")" 48 | 49 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 50 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 51 | local swift_runtime_libs 52 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 53 | for lib in $swift_runtime_libs; do 54 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 55 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 56 | code_sign_if_enabled "${destination}/${lib}" 57 | done 58 | fi 59 | } 60 | 61 | # Copies the dSYM of a vendored framework 62 | install_dsym() { 63 | local source="$1" 64 | if [ -r "$source" ]; then 65 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\"" 66 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}" 67 | fi 68 | } 69 | 70 | # Signs a framework with the provided identity 71 | code_sign_if_enabled() { 72 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 73 | # Use the current code_sign_identitiy 74 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 75 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 76 | 77 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 78 | code_sign_cmd="$code_sign_cmd &" 79 | fi 80 | echo "$code_sign_cmd" 81 | eval "$code_sign_cmd" 82 | fi 83 | } 84 | 85 | # Strip invalid architectures 86 | strip_invalid_archs() { 87 | binary="$1" 88 | # Get architectures for current file 89 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 90 | stripped="" 91 | for arch in $archs; do 92 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 93 | # Strip non-valid architectures in-place 94 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 95 | stripped="$stripped $arch" 96 | fi 97 | done 98 | if [[ "$stripped" ]]; then 99 | echo "Stripped $binary of architectures:$stripped" 100 | fi 101 | } 102 | 103 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 104 | wait 105 | fi 106 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HDTableViewMakerDemo/Pods-HDTableViewMakerDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/UITableView+FDTemplateLayoutCell" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/MJRefresh" "$PODS_CONFIGURATION_BUILD_DIR/Masonry" "$PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MJRefresh" -isystem "${PODS_ROOT}/Headers/Public/Masonry" -isystem "${PODS_ROOT}/Headers/Public/UITableView+FDTemplateLayoutCell" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"MJRefresh" -l"Masonry" -l"UITableView+FDTemplateLayoutCell" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HDTableViewMakerDemo/Pods-HDTableViewMakerDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/UITableView+FDTemplateLayoutCell" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/MJRefresh" "$PODS_CONFIGURATION_BUILD_DIR/Masonry" "$PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MJRefresh" -isystem "${PODS_ROOT}/Headers/Public/Masonry" -isystem "${PODS_ROOT}/Headers/Public/UITableView+FDTemplateLayoutCell" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"MJRefresh" -l"Masonry" -l"UITableView+FDTemplateLayoutCell" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_UITableView_FDTemplateLayoutCell : NSObject 3 | @end 4 | @implementation PodsDummy_UITableView_FDTemplateLayoutCell 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UITableView+FDTemplateLayoutCell" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/UITableView+FDTemplateLayoutCell" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/UITableView+FDTemplateLayoutCell 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDIndexPathHeightCache.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import 24 | 25 | @interface FDIndexPathHeightCache : NSObject 26 | 27 | // Enable automatically if you're using index path driven height cache 28 | @property (nonatomic, assign) BOOL automaticallyInvalidateEnabled; 29 | 30 | // Height cache 31 | - (BOOL)existsHeightAtIndexPath:(NSIndexPath *)indexPath; 32 | - (void)cacheHeight:(CGFloat)height byIndexPath:(NSIndexPath *)indexPath; 33 | - (CGFloat)heightForIndexPath:(NSIndexPath *)indexPath; 34 | - (void)invalidateHeightAtIndexPath:(NSIndexPath *)indexPath; 35 | - (void)invalidateAllHeightCache; 36 | 37 | @end 38 | 39 | @interface UITableView (FDIndexPathHeightCache) 40 | /// Height cache by index path. Generally, you don't need to use it directly. 41 | @property (nonatomic, strong, readonly) FDIndexPathHeightCache *fd_indexPathHeightCache; 42 | @end 43 | 44 | @interface UITableView (FDIndexPathHeightCacheInvalidation) 45 | /// Call this method when you want to reload data but don't want to invalidate 46 | /// all height cache by index path, for example, load more data at the bottom of 47 | /// table view. 48 | - (void)fd_reloadDataWithoutInvalidateIndexPathHeightCache; 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import 24 | 25 | @interface FDKeyedHeightCache : NSObject 26 | 27 | - (BOOL)existsHeightForKey:(id)key; 28 | - (void)cacheHeight:(CGFloat)height byKey:(id)key; 29 | - (CGFloat)heightForKey:(id)key; 30 | 31 | // Invalidation 32 | - (void)invalidateHeightForKey:(id)key; 33 | - (void)invalidateAllHeightCache; 34 | @end 35 | 36 | @interface UITableView (FDKeyedHeightCache) 37 | 38 | /// Height cache by key. Generally, you don't need to use it directly. 39 | @property (nonatomic, strong, readonly) FDKeyedHeightCache *fd_keyedHeightCache; 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import "UITableView+FDKeyedHeightCache.h" 24 | #import 25 | 26 | @interface FDKeyedHeightCache () 27 | @property (nonatomic, strong) NSMutableDictionary, NSNumber *> *mutableHeightsByKeyForPortrait; 28 | @property (nonatomic, strong) NSMutableDictionary, NSNumber *> *mutableHeightsByKeyForLandscape; 29 | @end 30 | 31 | @implementation FDKeyedHeightCache 32 | 33 | - (instancetype)init { 34 | self = [super init]; 35 | if (self) { 36 | _mutableHeightsByKeyForPortrait = [NSMutableDictionary dictionary]; 37 | _mutableHeightsByKeyForLandscape = [NSMutableDictionary dictionary]; 38 | } 39 | return self; 40 | } 41 | 42 | - (NSMutableDictionary, NSNumber *> *)mutableHeightsByKeyForCurrentOrientation { 43 | return UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation) ? self.mutableHeightsByKeyForPortrait: self.mutableHeightsByKeyForLandscape; 44 | } 45 | 46 | - (BOOL)existsHeightForKey:(id)key { 47 | NSNumber *number = self.mutableHeightsByKeyForCurrentOrientation[key]; 48 | return number && ![number isEqualToNumber:@-1]; 49 | } 50 | 51 | - (void)cacheHeight:(CGFloat)height byKey:(id)key { 52 | self.mutableHeightsByKeyForCurrentOrientation[key] = @(height); 53 | } 54 | 55 | - (CGFloat)heightForKey:(id)key { 56 | #if CGFLOAT_IS_DOUBLE 57 | return [self.mutableHeightsByKeyForCurrentOrientation[key] doubleValue]; 58 | #else 59 | return [self.mutableHeightsByKeyForCurrentOrientation[key] floatValue]; 60 | #endif 61 | } 62 | 63 | - (void)invalidateHeightForKey:(id)key { 64 | [self.mutableHeightsByKeyForPortrait removeObjectForKey:key]; 65 | [self.mutableHeightsByKeyForLandscape removeObjectForKey:key]; 66 | } 67 | 68 | - (void)invalidateAllHeightCache { 69 | [self.mutableHeightsByKeyForPortrait removeAllObjects]; 70 | [self.mutableHeightsByKeyForLandscape removeAllObjects]; 71 | } 72 | 73 | @end 74 | 75 | @implementation UITableView (FDKeyedHeightCache) 76 | 77 | - (FDKeyedHeightCache *)fd_keyedHeightCache { 78 | FDKeyedHeightCache *cache = objc_getAssociatedObject(self, _cmd); 79 | if (!cache) { 80 | cache = [FDKeyedHeightCache new]; 81 | objc_setAssociatedObject(self, _cmd, cache, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 82 | } 83 | return cache; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import 24 | 25 | @interface UITableView (FDTemplateLayoutCellDebug) 26 | 27 | /// Helps to debug or inspect what is this "FDTemplateLayoutCell" extention doing, 28 | /// turning on to print logs when "creating", "calculating", "precaching" or "hitting cache". 29 | /// 30 | /// Default to NO, log by NSLog. 31 | /// 32 | @property (nonatomic, assign) BOOL fd_debugLogEnabled; 33 | 34 | /// Debug log controlled by "fd_debugLogEnabled". 35 | - (void)fd_debugLog:(NSString *)message; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import "UITableView+FDTemplateLayoutCellDebug.h" 24 | #import 25 | 26 | @implementation UITableView (FDTemplateLayoutCellDebug) 27 | 28 | - (BOOL)fd_debugLogEnabled { 29 | return [objc_getAssociatedObject(self, _cmd) boolValue]; 30 | } 31 | 32 | - (void)setFd_debugLogEnabled:(BOOL)debugLogEnabled { 33 | objc_setAssociatedObject(self, @selector(fd_debugLogEnabled), @(debugLogEnabled), OBJC_ASSOCIATION_RETAIN); 34 | } 35 | 36 | - (void)fd_debugLog:(NSString *)message { 37 | if (self.fd_debugLogEnabled) { 38 | NSLog(@"** FDTemplateLayoutCell ** %@", message); 39 | } 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Pods/UITableView+FDTemplateLayoutCell/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /openSource.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongdong/HDTableViewMaker/c1d618e5fb4366b11490e983a7dde8acd4987c08/openSource.jpg -------------------------------------------------------------------------------- /pod trunk register fjhongdong@126.com 'AbnerH' --: -------------------------------------------------------------------------------- 1 | pod trunk register fjhongdong@126.com 'AbnerH' --description='macbook pro' --verbose 2 | pod trunk push HDTableViewMaker.podspec --------------------------------------------------------------------------------