├── .gitignore ├── .travis.yml ├── Example ├── HBTableViewFrameWork.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── HBTableViewFrameWork-Example.xcscheme ├── HBTableViewFrameWork.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── HBTableViewFrameWork │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── HBAppDelegate.h │ ├── HBAppDelegate.m │ ├── HBTableViewFrameWork-Info.plist │ ├── HBTableViewFrameWork-Prefix.pch │ ├── HBTestModel.h │ ├── HBTestModel.m │ ├── HBTestXIBModel.h │ ├── HBTestXIBModel.m │ ├── HBViewController.h │ ├── HBViewController.m │ ├── HBXIBTableViewCell.h │ ├── HBXIBTableViewCell.m │ ├── HBXIBTableViewCell.xib │ ├── HBXibViewController.h │ ├── HBXibViewController.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── SectionFooterView.h │ ├── SectionFooterView.m │ ├── SectionFooterView.xib │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── main.m │ ├── sectionHeaderView.h │ ├── sectionHeaderView.m │ └── sectionHeaderView.xib ├── Podfile ├── Podfile.lock ├── Pods │ ├── Local Podspecs │ │ └── HBTableViewFrameWork.podspec.json │ ├── 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 │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ └── Target Support Files │ │ ├── HBTableViewFrameWork │ │ ├── HBTableViewFrameWork-Info.plist │ │ ├── HBTableViewFrameWork-dummy.m │ │ ├── HBTableViewFrameWork-prefix.pch │ │ ├── HBTableViewFrameWork-umbrella.h │ │ ├── HBTableViewFrameWork.modulemap │ │ └── HBTableViewFrameWork.xcconfig │ │ ├── MJRefresh │ │ ├── MJRefresh-Info.plist │ │ ├── MJRefresh-dummy.m │ │ ├── MJRefresh-prefix.pch │ │ ├── MJRefresh-umbrella.h │ │ ├── MJRefresh.modulemap │ │ └── MJRefresh.xcconfig │ │ ├── Pods-HBTableViewFrameWork_Example │ │ ├── Pods-HBTableViewFrameWork_Example-Info.plist │ │ ├── Pods-HBTableViewFrameWork_Example-acknowledgements.markdown │ │ ├── Pods-HBTableViewFrameWork_Example-acknowledgements.plist │ │ ├── Pods-HBTableViewFrameWork_Example-dummy.m │ │ ├── Pods-HBTableViewFrameWork_Example-frameworks.sh │ │ ├── Pods-HBTableViewFrameWork_Example-umbrella.h │ │ ├── Pods-HBTableViewFrameWork_Example.debug.xcconfig │ │ ├── Pods-HBTableViewFrameWork_Example.modulemap │ │ └── Pods-HBTableViewFrameWork_Example.release.xcconfig │ │ └── Pods-HBTableViewFrameWork_Tests │ │ ├── Pods-HBTableViewFrameWork_Tests-Info.plist │ │ ├── Pods-HBTableViewFrameWork_Tests-acknowledgements.markdown │ │ ├── Pods-HBTableViewFrameWork_Tests-acknowledgements.plist │ │ ├── Pods-HBTableViewFrameWork_Tests-dummy.m │ │ ├── Pods-HBTableViewFrameWork_Tests-umbrella.h │ │ ├── Pods-HBTableViewFrameWork_Tests.debug.xcconfig │ │ ├── Pods-HBTableViewFrameWork_Tests.modulemap │ │ └── Pods-HBTableViewFrameWork_Tests.release.xcconfig └── Tests │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── en.lproj │ └── InfoPlist.strings ├── HBTableViewFrameWork.podspec ├── HBTableViewFrameWork ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── HBTableViewBaseViewClass.h │ ├── HBTableViewBaseViewClass.m │ ├── HBTableViewBaseViewProtocol.h │ ├── HBTableViewDataSource.h │ ├── HBTableViewDataSource.m │ ├── HBTableViewListFrame.h │ ├── HBTableViewListFrame.m │ ├── HBTableViewSectionModelClass.h │ ├── HBTableViewSectionModelClass.m │ ├── HBTableViewSectionModelProtocol.h │ ├── HBTableViewSectionViewModel.h │ ├── HBTableViewSectionViewModel.m │ └── HBTableViewSectionViewModelProtocol.h ├── LICENSE ├── README.md └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 26 | # Carthage/Checkouts 27 | 28 | Carthage/Build 29 | 30 | # We recommend against adding the Pods directory to your .gitignore. However 31 | # you should judge for yourself, the pros and cons are mentioned at: 32 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 33 | # 34 | # Note: if you ignore the Pods directory, make sure to uncomment 35 | # `pod install` in .travis.yml 36 | # 37 | # Pods/ 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/ 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/HBTableViewFrameWork.xcworkspace -scheme HBTableViewFrameWork-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork.xcodeproj/xcshareddata/xcschemes/HBTableViewFrameWork-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/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 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBAppDelegate.h 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hulailin on 01/10/2019. 6 | // Copyright (c) 2019 hulailin. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface HBAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBAppDelegate.m 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hulailin on 01/10/2019. 6 | // Copyright (c) 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBAppDelegate.h" 10 | #import "HBViewController.h" 11 | @implementation HBAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[HBViewController alloc] init]]; 17 | return YES; 18 | } 19 | 20 | - (void)applicationWillResignActive:(UIApplication *)application 21 | { 22 | // Sent when the application is about to move from active to inactive state. This can occur for 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. 23 | // 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. 24 | } 25 | 26 | - (void)applicationDidEnterBackground:(UIApplication *)application 27 | { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | - (void)applicationWillEnterForeground:(UIApplication *)application 33 | { 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 | { 39 | // 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. 40 | } 41 | 42 | - (void)applicationWillTerminate:(UIApplication *)application 43 | { 44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBTableViewFrameWork-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBTableViewFrameWork-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBTestModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTestModel.h 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTableViewSectionModelClass.h" 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface HBTestModel : HBTableViewCellModelClass 13 | 14 | @property(nonatomic, copy) NSString *titleName; 15 | 16 | @property(nonatomic, copy) NSString *detail; 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBTestModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTestModel.m 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTestModel.h" 10 | 11 | @implementation HBTestModel 12 | 13 | - (NSString *)cellReusable{ 14 | return @"UITableViewCell"; 15 | } 16 | 17 | - (CGFloat)rowHeight{ 18 | return 100; 19 | } 20 | 21 | - (BOOL)isNib{ 22 | return NO; 23 | } 24 | @end 25 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBTestXIBModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTestXIBModel.h 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | 10 | #import "HBTableViewSectionModelClass.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HBTestXIBModel : HBTableViewCellModelClass 15 | @property(nonatomic, copy) NSString *titleName; 16 | @property(nonatomic, copy) NSString *detail; 17 | 18 | 19 | @end 20 | 21 | 22 | @interface HBTestXIBSectionModel : HBTableViewSectionModelClass 23 | 24 | @property(nonatomic, copy) NSString *itemName; 25 | 26 | 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBTestXIBModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTestXIBModel.m 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTestXIBModel.h" 10 | #import "MJRefresh.h" 11 | @implementation HBTestXIBModel 12 | 13 | - (NSString *)cellReusable{ 14 | return @"HBXIBTableViewCell"; 15 | } 16 | 17 | 18 | - (CGFloat)rowHeight{ 19 | return 100.0; 20 | } 21 | - (BOOL)isNib{ 22 | return YES; 23 | } 24 | 25 | @end 26 | 27 | 28 | @implementation HBTestXIBSectionModel 29 | 30 | 31 | - (CGFloat)sectionHeaderHeight{ 32 | return 40; 33 | } 34 | 35 | - (NSString *)nibHeaderName{ 36 | return @"sectionHeaderView"; 37 | } 38 | 39 | //- (NSString *)viewHeaderClass{ 40 | // return @"sectionHeaderView"; 41 | //} 42 | 43 | 44 | - (CGFloat)sectionFooterHeight{ 45 | return 30; 46 | } 47 | 48 | - (NSString *)nibFooterName{ 49 | return @"SectionFooterView"; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBViewController.h 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hulailin on 01/10/2019. 6 | // Copyright (c) 2019 hulailin. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface HBViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBViewController.m 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hulailin on 01/10/2019. 6 | // Copyright (c) 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBViewController.h" 10 | #import "HBTableViewDataSource.h" 11 | #import "HBTestModel.h" 12 | #import "HBXibViewController.h" 13 | #import "HBTableViewListFrame.h" 14 | #import "MJRefresh.h" 15 | @interface HBViewController () 16 | @property(strong, nonatomic) UITableView *tableView; 17 | @property (nonatomic ,strong) NSMutableArray *dataArray; 18 | 19 | @property(nonatomic, copy) HBTableViewListFrame *tableViewList; 20 | @end 21 | 22 | @implementation HBViewController 23 | 24 | - (void)viewDidLoad 25 | { 26 | [super viewDidLoad]; 27 | // Do any additional setup after loading the view, typically from a nib. 28 | self.title = @"首页"; 29 | [self loadData]; 30 | 31 | [self.view addSubview:self.tableView]; 32 | 33 | 34 | self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ 35 | __weak __typeof(self)weakSelf = self; 36 | [weakSelf.dataArray addObjectsFromArray:self.dataArray]; 37 | [weakSelf.tableView.mj_header endRefreshing]; 38 | [weakSelf dataArrayFormart]; 39 | }]; 40 | // //转换数据源 41 | [self dataArrayFormart]; 42 | 43 | 44 | } 45 | 46 | 47 | #pragma mark - private methods(私有方法) 48 | - (void)loadData{ 49 | HBTestModel *test01 = [[HBTestModel alloc] init]; 50 | test01.titleName =@"用代码加载cell"; 51 | test01.detail =@"第一条测试数据副标题"; 52 | 53 | HBTestModel *test02 = [[HBTestModel alloc] init]; 54 | test02.titleName =@"用xib加载cell"; 55 | test02.detail =@"第二条测试数据副标题"; 56 | 57 | self.dataArray = @[test01,test02].mutableCopy; 58 | 59 | } 60 | 61 | - (void)dataArrayFormart{ 62 | [self.tableViewList updateListWithModels:self.dataArray dataConfigBlock:^(id _Nonnull cell, id _Nonnull model) { 63 | UITableViewCell *cellView =(UITableViewCell *)cell; 64 | cellView.backgroundColor = [UIColor orangeColor]; 65 | HBTestModel *viewModel = (HBTestModel *)model; 66 | cellView.textLabel.text = viewModel.titleName; 67 | cellView.detailTextLabel.text = viewModel.detail; 68 | } didSelectRowAtIndexPath:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath, id _Nonnull rowData) { 69 | __weak typeof(self)weakSelf = self; 70 | 71 | HBXibViewController *vc = [[HBXibViewController alloc] init]; 72 | [weakSelf.navigationController pushViewController:vc animated:YES]; 73 | 74 | }]; 75 | 76 | } 77 | 78 | 79 | #pragma mark - getters and setters 80 | - (UITableView *)tableView { 81 | if (!_tableView) { 82 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 83 | 84 | } 85 | return _tableView; 86 | } 87 | 88 | - (NSMutableArray *)dataArray{ 89 | if (!_dataArray) { 90 | _dataArray = [[NSMutableArray alloc] init]; 91 | } 92 | return _dataArray; 93 | } 94 | 95 | - (HBTableViewListFrame *)tableViewList{ 96 | if (!_tableViewList) { 97 | _tableViewList = [HBTableViewListFrame tableViewListFrame:self.tableView]; 98 | } 99 | return _tableViewList; 100 | } 101 | @end 102 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBXIBTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBXIBTableViewCell.h 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTableViewBaseViewClass.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HBXIBTableViewCell : HBTableViewBaseCell 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBXIBTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBXIBTableViewCell.m 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBXIBTableViewCell.h" 10 | #import "HBTestXIBModel.h" 11 | 12 | @interface HBXIBTableViewCell() 13 | @property (weak, nonatomic) IBOutlet UILabel *titleName; 14 | 15 | @end 16 | 17 | @implementation HBXIBTableViewCell 18 | 19 | - (void)awakeFromNib { 20 | [super awakeFromNib]; 21 | // Initialization code 22 | } 23 | - (void)updateWithCellData:(id)aData{ 24 | HBTestXIBModel *model = (HBTestXIBModel *)aData; 25 | self.titleName.text = model.titleName; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBXIBTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBXibViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBXibViewController.h 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HBXibViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/HBXibViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBXibViewController.m 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBXibViewController.h" 10 | #import "HBTableViewListFrame.h" 11 | #import "HBTestXIBModel.h" 12 | #import "MJRefresh.h" 13 | @interface HBXibViewController () 14 | @property(strong, nonatomic) UITableView *tableView; 15 | @property (nonatomic ,strong) NSMutableArray *dataArray; 16 | @property (nonatomic ,strong) HBTableViewListFrame *tableViewListFrame; 17 | 18 | 19 | @end 20 | 21 | @implementation HBXibViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view. 26 | self.title = @"用xib加载tablview"; 27 | 28 | [self.view addSubview:self.tableView]; 29 | 30 | [self loadData]; 31 | 32 | 33 | 34 | 35 | } 36 | 37 | 38 | #pragma mark - private methods(私有方法) 39 | - (void)loadData{ 40 | 41 | HBTestXIBModel *test01 = [[HBTestXIBModel alloc] init]; 42 | test01.titleName =@"用代码加载cell"; 43 | test01.detail =@"第一条测试数据副标题"; 44 | 45 | HBTestXIBModel *test02 = [[HBTestXIBModel alloc] init]; 46 | test02.titleName =@"用xib加载cell"; 47 | test02.detail =@"第二条测试数据副标题"; 48 | 49 | HBTestXIBModel *test03 = [[HBTestXIBModel alloc] init]; 50 | test03.titleName =@"这是第三条测试数据"; 51 | test03.detail =@"第三条测试数据副标题"; 52 | 53 | HBTestXIBModel *test04 = [[HBTestXIBModel alloc] init]; 54 | test04.titleName =@"这是第四条测试数据"; 55 | test04.detail =@"第四条测试数据副标题"; 56 | 57 | self.dataArray = @[test01,test02,test03,test04 ].mutableCopy; 58 | 59 | HBTestXIBSectionModel *model = [[HBTestXIBSectionModel alloc] init]; 60 | model.itemName = @"第0个分区"; 61 | model.rowArray = self.dataArray; 62 | 63 | HBTestXIBSectionModel *model1 = [[HBTestXIBSectionModel alloc] init]; 64 | model1.itemName = @"第1个分区"; 65 | model1.rowArray = self.dataArray; 66 | 67 | HBTestXIBSectionModel *model2 = [[HBTestXIBSectionModel alloc] init]; 68 | model2.itemName = @"第2个分区"; 69 | model2.rowArray = self.dataArray; 70 | 71 | [self.tableViewListFrame updateListWithSectionModels:@[model,model1,model2] dataConfigBlock:^(id cell, id model) { 72 | 73 | } didSelectRowAtIndexPath:^(UITableView *tableView, NSIndexPath *indexPath, id rowData) { 74 | NSLog(@"分区 indexPath.secion %ld,行indexPath.row %ld",indexPath.section,indexPath.row); 75 | }]; 76 | 77 | } 78 | #pragma mark - getters and setters 79 | - (UITableView *)tableView { 80 | if (!_tableView) { 81 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain]; 82 | 83 | } 84 | return _tableView; 85 | } 86 | 87 | - (NSMutableArray *)dataArray{ 88 | if (!_dataArray) { 89 | _dataArray = [[NSMutableArray alloc] init]; 90 | } 91 | return _dataArray; 92 | } 93 | 94 | - (HBTableViewListFrame *)tableViewListFrame{ 95 | if (!_tableViewListFrame) { 96 | _tableViewListFrame = [HBTableViewListFrame tableViewListFrame:self.tableView] ; 97 | } 98 | return _tableViewListFrame; 99 | } 100 | @end 101 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/SectionFooterView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SectionFooterView.h 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/17. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTableViewBaseViewClass.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface SectionFooterView : HBTableViewBaseViewClass 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/SectionFooterView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SectionFooterView.m 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/17. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import "SectionFooterView.h" 10 | 11 | @implementation SectionFooterView 12 | 13 | - (void)fillData:(id)data{ 14 | 15 | } 16 | @end 17 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/SectionFooterView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hulailin on 01/10/2019. 6 | // Copyright (c) 2019 hulailin. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "HBAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([HBAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/sectionHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // sectionHeaderView.h 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/17. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTableViewBaseViewClass.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface sectionHeaderView : HBTableViewBaseViewClass 14 | @property (weak, nonatomic) IBOutlet UILabel *title; 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/sectionHeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // sectionHeaderView.m 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/17. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import "sectionHeaderView.h" 10 | #import "HBTestXIBModel.h" 11 | @implementation sectionHeaderView 12 | 13 | -(void)fillData:(id)data{ 14 | HBTestXIBSectionModel* model = ( HBTestXIBSectionModel*)data; 15 | self.title.text = model.itemName; 16 | } 17 | 18 | - (IBAction)btnClick:(id)sender { 19 | 20 | NSLog(@"更多按钮点击"); 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/HBTableViewFrameWork/sectionHeaderView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 25 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | platform :ios, '8.0' 4 | 5 | target 'HBTableViewFrameWork_Example' do 6 | pod 'HBTableViewFrameWork', :path => '../' 7 | pod 'MJRefresh', '~> 3.1.15.7' 8 | target 'HBTableViewFrameWork_Tests' do 9 | inherit! :search_paths 10 | 11 | 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HBTableViewFrameWork (0.1.7) 3 | - MJRefresh (3.1.15.7) 4 | 5 | DEPENDENCIES: 6 | - HBTableViewFrameWork (from `../`) 7 | - MJRefresh (~> 3.1.15.7) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - MJRefresh 12 | 13 | EXTERNAL SOURCES: 14 | HBTableViewFrameWork: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | HBTableViewFrameWork: 2fca9a13dc34e96c213d0b6e29f5b160e00292c0 19 | MJRefresh: 697f8ec75ebdbe9207767bb682cf0f51b0d8a41f 20 | 21 | PODFILE CHECKSUM: 5ffe661366bbd8fc2c2bbf16fd41eb1dc2f47b58 22 | 23 | COCOAPODS: 1.7.5 24 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/HBTableViewFrameWork.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HBTableViewFrameWork", 3 | "version": "0.1.7", 4 | "summary": "快速搭建表格框架", 5 | "description": "快速搭建表格框架", 6 | "homepage": "https://github.com/hulailin/HBTableViewFrameWork", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "hulailin": "hulailin@126.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/hulailin/HBTableViewFrameWork.git", 16 | "tag": "0.1.7" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "HBTableViewFrameWork/Classes/**/*" 22 | } 23 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | 21 | /** 是否每一次拖拽只发一次请求 */ 22 | @property (assign, nonatomic, getter=isOnlyRefreshPerDrag) BOOL onlyRefreshPerDrag; 23 | @end 24 | -------------------------------------------------------------------------------- /Example/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 | /** 一个新的拖拽 */ 13 | @property (assign, nonatomic, getter=isOneNewPan) BOOL oneNewPan; 14 | @end 15 | 16 | @implementation MJRefreshAutoFooter 17 | 18 | #pragma mark - 初始化 19 | - (void)willMoveToSuperview:(UIView *)newSuperview 20 | { 21 | [super willMoveToSuperview:newSuperview]; 22 | 23 | if (newSuperview) { // 新的父控件 24 | if (self.hidden == NO) { 25 | self.scrollView.mj_insetB += self.mj_h; 26 | } 27 | 28 | // 设置位置 29 | self.mj_y = _scrollView.mj_contentH; 30 | } else { // 被移除了 31 | if (self.hidden == NO) { 32 | self.scrollView.mj_insetB -= self.mj_h; 33 | } 34 | } 35 | } 36 | 37 | #pragma mark - 过期方法 38 | - (void)setAppearencePercentTriggerAutoRefresh:(CGFloat)appearencePercentTriggerAutoRefresh 39 | { 40 | self.triggerAutomaticallyRefreshPercent = appearencePercentTriggerAutoRefresh; 41 | } 42 | 43 | - (CGFloat)appearencePercentTriggerAutoRefresh 44 | { 45 | return self.triggerAutomaticallyRefreshPercent; 46 | } 47 | 48 | #pragma mark - 实现父类的方法 49 | - (void)prepare 50 | { 51 | [super prepare]; 52 | 53 | // 默认底部控件100%出现时才会自动刷新 54 | self.triggerAutomaticallyRefreshPercent = 1.0; 55 | 56 | // 设置为默认状态 57 | self.automaticallyRefresh = YES; 58 | 59 | // 默认是当offset达到条件就发送请求(可连续) 60 | self.onlyRefreshPerDrag = NO; 61 | } 62 | 63 | - (void)scrollViewContentSizeDidChange:(NSDictionary *)change 64 | { 65 | [super scrollViewContentSizeDidChange:change]; 66 | 67 | // 设置位置 68 | self.mj_y = self.scrollView.mj_contentH; 69 | } 70 | 71 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change 72 | { 73 | [super scrollViewContentOffsetDidChange:change]; 74 | 75 | if (self.state != MJRefreshStateIdle || !self.automaticallyRefresh || self.mj_y == 0) return; 76 | 77 | if (_scrollView.mj_insetT + _scrollView.mj_contentH > _scrollView.mj_h) { // 内容超过一个屏幕 78 | // 这里的_scrollView.mj_contentH替换掉self.mj_y更为合理 79 | if (_scrollView.mj_offsetY >= _scrollView.mj_contentH - _scrollView.mj_h + self.mj_h * self.triggerAutomaticallyRefreshPercent + _scrollView.mj_insetB - self.mj_h) { 80 | // 防止手松开时连续调用 81 | CGPoint old = [change[@"old"] CGPointValue]; 82 | CGPoint new = [change[@"new"] CGPointValue]; 83 | if (new.y <= old.y) return; 84 | 85 | // 当底部刷新控件完全出现时,才刷新 86 | [self beginRefreshing]; 87 | } 88 | } 89 | } 90 | 91 | - (void)scrollViewPanStateDidChange:(NSDictionary *)change 92 | { 93 | [super scrollViewPanStateDidChange:change]; 94 | 95 | if (self.state != MJRefreshStateIdle) return; 96 | 97 | UIGestureRecognizerState panState = _scrollView.panGestureRecognizer.state; 98 | if (panState == UIGestureRecognizerStateEnded) {// 手松开 99 | if (_scrollView.mj_insetT + _scrollView.mj_contentH <= _scrollView.mj_h) { // 不够一个屏幕 100 | if (_scrollView.mj_offsetY >= - _scrollView.mj_insetT) { // 向上拽 101 | [self beginRefreshing]; 102 | } 103 | } else { // 超出一个屏幕 104 | if (_scrollView.mj_offsetY >= _scrollView.mj_contentH + _scrollView.mj_insetB - _scrollView.mj_h) { 105 | [self beginRefreshing]; 106 | } 107 | } 108 | } else if (panState == UIGestureRecognizerStateBegan) { 109 | self.oneNewPan = YES; 110 | } 111 | } 112 | 113 | - (void)beginRefreshing 114 | { 115 | if (!self.isOneNewPan && self.isOnlyRefreshPerDrag) return; 116 | 117 | [super beginRefreshing]; 118 | 119 | self.oneNewPan = NO; 120 | } 121 | 122 | - (void)setState:(MJRefreshState)state 123 | { 124 | MJRefreshCheckState 125 | 126 | if (state == MJRefreshStateRefreshing) { 127 | [self executeRefreshingCallback]; 128 | } else if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { 129 | if (MJRefreshStateRefreshing == oldState) { 130 | if (self.endRefreshingCompletionBlock) { 131 | self.endRefreshingCompletionBlock(); 132 | } 133 | } 134 | } 135 | } 136 | 137 | - (void)setHidden:(BOOL)hidden 138 | { 139 | BOOL lastHidden = self.isHidden; 140 | 141 | [super setHidden:hidden]; 142 | 143 | if (!lastHidden && hidden) { 144 | self.state = MJRefreshStateIdle; 145 | 146 | self.scrollView.mj_insetB -= self.mj_h; 147 | } else if (lastHidden && !hidden) { 148 | self.scrollView.mj_insetB += self.mj_h; 149 | 150 | // 设置位置 151 | self.mj_y = _scrollView.mj_contentH; 152 | } 153 | } 154 | @end 155 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/MJRefresh/MJRefresh/Base/MJRefreshBackFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshBackFooter.m 3 | // MJRefreshExample 4 | // 5 | // Created by MJ Lee on 15/4/24. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJRefreshBackFooter.h" 10 | 11 | @interface MJRefreshBackFooter() 12 | @property (assign, nonatomic) NSInteger lastRefreshCount; 13 | @property (assign, nonatomic) CGFloat lastBottomDelta; 14 | @end 15 | 16 | @implementation MJRefreshBackFooter 17 | 18 | #pragma mark - 初始化 19 | - (void)willMoveToSuperview:(UIView *)newSuperview 20 | { 21 | [super willMoveToSuperview:newSuperview]; 22 | 23 | [self scrollViewContentSizeDidChange:nil]; 24 | } 25 | 26 | #pragma mark - 实现父类的方法 27 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change 28 | { 29 | [super scrollViewContentOffsetDidChange:change]; 30 | 31 | // 如果正在刷新,直接返回 32 | if (self.state == MJRefreshStateRefreshing) return; 33 | 34 | _scrollViewOriginalInset = self.scrollView.mj_inset; 35 | 36 | // 当前的contentOffset 37 | CGFloat currentOffsetY = self.scrollView.mj_offsetY; 38 | // 尾部控件刚好出现的offsetY 39 | CGFloat happenOffsetY = [self happenOffsetY]; 40 | // 如果是向下滚动到看不见尾部控件,直接返回 41 | if (currentOffsetY <= happenOffsetY) return; 42 | 43 | CGFloat pullingPercent = (currentOffsetY - happenOffsetY) / self.mj_h; 44 | 45 | // 如果已全部加载,仅设置pullingPercent,然后返回 46 | if (self.state == MJRefreshStateNoMoreData) { 47 | self.pullingPercent = pullingPercent; 48 | return; 49 | } 50 | 51 | if (self.scrollView.isDragging) { 52 | self.pullingPercent = pullingPercent; 53 | // 普通 和 即将刷新 的临界点 54 | CGFloat normal2pullingOffsetY = happenOffsetY + self.mj_h; 55 | 56 | if (self.state == MJRefreshStateIdle && currentOffsetY > normal2pullingOffsetY) { 57 | // 转为即将刷新状态 58 | self.state = MJRefreshStatePulling; 59 | } else if (self.state == MJRefreshStatePulling && currentOffsetY <= normal2pullingOffsetY) { 60 | // 转为普通状态 61 | self.state = MJRefreshStateIdle; 62 | } 63 | } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开 64 | // 开始刷新 65 | [self beginRefreshing]; 66 | } else if (pullingPercent < 1) { 67 | self.pullingPercent = pullingPercent; 68 | } 69 | } 70 | 71 | - (void)scrollViewContentSizeDidChange:(NSDictionary *)change 72 | { 73 | [super scrollViewContentSizeDidChange:change]; 74 | 75 | // 内容的高度 76 | CGFloat contentHeight = self.scrollView.mj_contentH + self.ignoredScrollViewContentInsetBottom; 77 | // 表格的高度 78 | CGFloat scrollHeight = self.scrollView.mj_h - self.scrollViewOriginalInset.top - self.scrollViewOriginalInset.bottom + self.ignoredScrollViewContentInsetBottom; 79 | // 设置位置和尺寸 80 | self.mj_y = MAX(contentHeight, scrollHeight); 81 | } 82 | 83 | - (void)setState:(MJRefreshState)state 84 | { 85 | MJRefreshCheckState 86 | 87 | // 根据状态来设置属性 88 | if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { 89 | // 刷新完毕 90 | if (MJRefreshStateRefreshing == oldState) { 91 | [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ 92 | self.scrollView.mj_insetB -= self.lastBottomDelta; 93 | 94 | // 自动调整透明度 95 | if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0; 96 | } completion:^(BOOL finished) { 97 | self.pullingPercent = 0.0; 98 | 99 | if (self.endRefreshingCompletionBlock) { 100 | self.endRefreshingCompletionBlock(); 101 | } 102 | }]; 103 | } 104 | 105 | CGFloat deltaH = [self heightForContentBreakView]; 106 | // 刚刷新完毕 107 | if (MJRefreshStateRefreshing == oldState && deltaH > 0 && self.scrollView.mj_totalDataCount != self.lastRefreshCount) { 108 | self.scrollView.mj_offsetY = self.scrollView.mj_offsetY; 109 | } 110 | } else if (state == MJRefreshStateRefreshing) { 111 | // 记录刷新前的数量 112 | self.lastRefreshCount = self.scrollView.mj_totalDataCount; 113 | 114 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 115 | CGFloat bottom = self.mj_h + self.scrollViewOriginalInset.bottom; 116 | CGFloat deltaH = [self heightForContentBreakView]; 117 | if (deltaH < 0) { // 如果内容高度小于view的高度 118 | bottom -= deltaH; 119 | } 120 | self.lastBottomDelta = bottom - self.scrollView.mj_insetB; 121 | self.scrollView.mj_insetB = bottom; 122 | self.scrollView.mj_offsetY = [self happenOffsetY] + self.mj_h; 123 | } completion:^(BOOL finished) { 124 | [self executeRefreshingCallback]; 125 | }]; 126 | } 127 | } 128 | #pragma mark - 私有方法 129 | #pragma mark 获得scrollView的内容 超出 view 的高度 130 | - (CGFloat)heightForContentBreakView 131 | { 132 | CGFloat h = self.scrollView.frame.size.height - self.scrollViewOriginalInset.bottom - self.scrollViewOriginalInset.top; 133 | return self.scrollView.contentSize.height - h; 134 | } 135 | 136 | #pragma mark 刚好看到上拉刷新控件时的contentOffset.y 137 | - (CGFloat)happenOffsetY 138 | { 139 | CGFloat deltaH = [self heightForContentBreakView]; 140 | if (deltaH > 0) { 141 | return deltaH - self.scrollViewOriginalInset.top; 142 | } else { 143 | return - self.scrollViewOriginalInset.top; 144 | } 145 | } 146 | @end 147 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/MJRefresh/MJRefresh/Base/MJRefreshComponent.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 | // MJRefreshComponent.m 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 | #import "MJRefreshConst.h" 12 | 13 | @interface MJRefreshComponent() 14 | @property (strong, nonatomic) UIPanGestureRecognizer *pan; 15 | @end 16 | 17 | @implementation MJRefreshComponent 18 | #pragma mark - 初始化 19 | - (instancetype)initWithFrame:(CGRect)frame 20 | { 21 | if (self = [super initWithFrame:frame]) { 22 | // 准备工作 23 | [self prepare]; 24 | 25 | // 默认是普通状态 26 | self.state = MJRefreshStateIdle; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)prepare 32 | { 33 | // 基本属性 34 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth; 35 | self.backgroundColor = [UIColor clearColor]; 36 | } 37 | 38 | - (void)layoutSubviews 39 | { 40 | [self placeSubviews]; 41 | 42 | [super layoutSubviews]; 43 | } 44 | 45 | - (void)placeSubviews{} 46 | 47 | - (void)willMoveToSuperview:(UIView *)newSuperview 48 | { 49 | [super willMoveToSuperview:newSuperview]; 50 | 51 | // 如果不是UIScrollView,不做任何事情 52 | if (newSuperview && ![newSuperview isKindOfClass:[UIScrollView class]]) return; 53 | 54 | // 旧的父控件移除监听 55 | [self removeObservers]; 56 | 57 | if (newSuperview) { // 新的父控件 58 | // 设置宽度 59 | self.mj_w = newSuperview.mj_w; 60 | // 设置位置 61 | self.mj_x = -_scrollView.mj_insetL; 62 | 63 | // 记录UIScrollView 64 | _scrollView = (UIScrollView *)newSuperview; 65 | // 设置永远支持垂直弹簧效果 66 | _scrollView.alwaysBounceVertical = YES; 67 | // 记录UIScrollView最开始的contentInset 68 | _scrollViewOriginalInset = _scrollView.mj_inset; 69 | 70 | // 添加监听 71 | [self addObservers]; 72 | } 73 | } 74 | 75 | - (void)drawRect:(CGRect)rect 76 | { 77 | [super drawRect:rect]; 78 | 79 | if (self.state == MJRefreshStateWillRefresh) { 80 | // 预防view还没显示出来就调用了beginRefreshing 81 | self.state = MJRefreshStateRefreshing; 82 | } 83 | } 84 | 85 | #pragma mark - KVO监听 86 | - (void)addObservers 87 | { 88 | NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld; 89 | [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentOffset options:options context:nil]; 90 | [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentSize options:options context:nil]; 91 | self.pan = self.scrollView.panGestureRecognizer; 92 | [self.pan addObserver:self forKeyPath:MJRefreshKeyPathPanState options:options context:nil]; 93 | } 94 | 95 | - (void)removeObservers 96 | { 97 | [self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentOffset]; 98 | [self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentSize]; 99 | [self.pan removeObserver:self forKeyPath:MJRefreshKeyPathPanState]; 100 | self.pan = nil; 101 | } 102 | 103 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 104 | { 105 | // 遇到这些情况就直接返回 106 | if (!self.userInteractionEnabled) return; 107 | 108 | // 这个就算看不见也需要处理 109 | if ([keyPath isEqualToString:MJRefreshKeyPathContentSize]) { 110 | [self scrollViewContentSizeDidChange:change]; 111 | } 112 | 113 | // 看不见 114 | if (self.hidden) return; 115 | if ([keyPath isEqualToString:MJRefreshKeyPathContentOffset]) { 116 | [self scrollViewContentOffsetDidChange:change]; 117 | } else if ([keyPath isEqualToString:MJRefreshKeyPathPanState]) { 118 | [self scrollViewPanStateDidChange:change]; 119 | } 120 | } 121 | 122 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{} 123 | - (void)scrollViewContentSizeDidChange:(NSDictionary *)change{} 124 | - (void)scrollViewPanStateDidChange:(NSDictionary *)change{} 125 | 126 | #pragma mark - 公共方法 127 | #pragma mark 设置回调对象和回调方法 128 | - (void)setRefreshingTarget:(id)target refreshingAction:(SEL)action 129 | { 130 | self.refreshingTarget = target; 131 | self.refreshingAction = action; 132 | } 133 | 134 | - (void)setState:(MJRefreshState)state 135 | { 136 | _state = state; 137 | 138 | // 加入主队列的目的是等setState:方法调用完毕、设置完文字后再去布局子控件 139 | MJRefreshDispatchAsyncOnMainQueue([self setNeedsLayout];) 140 | } 141 | 142 | #pragma mark 进入刷新状态 143 | - (void)beginRefreshing 144 | { 145 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 146 | self.alpha = 1.0; 147 | }]; 148 | self.pullingPercent = 1.0; 149 | // 只要正在刷新,就完全显示 150 | if (self.window) { 151 | self.state = MJRefreshStateRefreshing; 152 | } else { 153 | // 预防正在刷新中时,调用本方法使得header inset回置失败 154 | if (self.state != MJRefreshStateRefreshing) { 155 | self.state = MJRefreshStateWillRefresh; 156 | // 刷新(预防从另一个控制器回到这个控制器的情况,回来要重新刷新一下) 157 | [self setNeedsDisplay]; 158 | } 159 | } 160 | } 161 | 162 | - (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock 163 | { 164 | self.beginRefreshingCompletionBlock = completionBlock; 165 | 166 | [self beginRefreshing]; 167 | } 168 | 169 | #pragma mark 结束刷新状态 170 | - (void)endRefreshing 171 | { 172 | MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateIdle;) 173 | } 174 | 175 | - (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock 176 | { 177 | self.endRefreshingCompletionBlock = completionBlock; 178 | 179 | [self endRefreshing]; 180 | } 181 | 182 | #pragma mark 是否正在刷新 183 | - (BOOL)isRefreshing 184 | { 185 | return self.state == MJRefreshStateRefreshing || self.state == MJRefreshStateWillRefresh; 186 | } 187 | 188 | #pragma mark 自动切换透明度 189 | - (void)setAutoChangeAlpha:(BOOL)autoChangeAlpha 190 | { 191 | self.automaticallyChangeAlpha = autoChangeAlpha; 192 | } 193 | 194 | - (BOOL)isAutoChangeAlpha 195 | { 196 | return self.isAutomaticallyChangeAlpha; 197 | } 198 | 199 | - (void)setAutomaticallyChangeAlpha:(BOOL)automaticallyChangeAlpha 200 | { 201 | _automaticallyChangeAlpha = automaticallyChangeAlpha; 202 | 203 | if (self.isRefreshing) return; 204 | 205 | if (automaticallyChangeAlpha) { 206 | self.alpha = self.pullingPercent; 207 | } else { 208 | self.alpha = 1.0; 209 | } 210 | } 211 | 212 | #pragma mark 根据拖拽进度设置透明度 213 | - (void)setPullingPercent:(CGFloat)pullingPercent 214 | { 215 | _pullingPercent = pullingPercent; 216 | 217 | if (self.isRefreshing) return; 218 | 219 | if (self.isAutomaticallyChangeAlpha) { 220 | self.alpha = pullingPercent; 221 | } 222 | } 223 | 224 | #pragma mark - 内部方法 225 | - (void)executeRefreshingCallback 226 | { 227 | MJRefreshDispatchAsyncOnMainQueue({ 228 | if (self.refreshingBlock) { 229 | self.refreshingBlock(); 230 | } 231 | if ([self.refreshingTarget respondsToSelector:self.refreshingAction]) { 232 | MJRefreshMsgSend(MJRefreshMsgTarget(self.refreshingTarget), self.refreshingAction, self); 233 | } 234 | if (self.beginRefreshingCompletionBlock) { 235 | self.beginRefreshingCompletionBlock(); 236 | } 237 | }) 238 | } 239 | @end 240 | 241 | @implementation UILabel(MJRefresh) 242 | + (instancetype)mj_label 243 | { 244 | UILabel *label = [[self alloc] init]; 245 | label.font = MJRefreshLabelFont; 246 | label.textColor = MJRefreshLabelTextColor; 247 | label.autoresizingMask = UIViewAutoresizingFlexibleWidth; 248 | label.textAlignment = NSTextAlignmentCenter; 249 | label.backgroundColor = [UIColor clearColor]; 250 | return label; 251 | } 252 | 253 | - (CGFloat)mj_textWith { 254 | CGFloat stringWidth = 0; 255 | CGSize size = CGSizeMake(MAXFLOAT, MAXFLOAT); 256 | if (self.text.length > 0) { 257 | #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 258 | stringWidth =[self.text 259 | boundingRectWithSize:size 260 | options:NSStringDrawingUsesLineFragmentOrigin 261 | attributes:@{NSFontAttributeName:self.font} 262 | context:nil].size.width; 263 | #else 264 | 265 | stringWidth = [self.text sizeWithFont:self.font 266 | constrainedToSize:size 267 | lineBreakMode:NSLineBreakByCharWrapping].width; 268 | #endif 269 | } 270 | return stringWidth; 271 | } 272 | @end 273 | -------------------------------------------------------------------------------- /Example/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 MJRefreshDeprecated("不建议使用此属性,开发者请自行控制footer的显示和隐藏。基于安全考虑,在未来的某些版本此属性可能作废"); 30 | @end 31 | -------------------------------------------------------------------------------- /Example/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 | #include "UIScrollView+MJRefresh.h" 12 | 13 | @interface MJRefreshFooter() 14 | 15 | @end 16 | 17 | @implementation MJRefreshFooter 18 | #pragma mark - 构造方法 19 | + (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock 20 | { 21 | MJRefreshFooter *cmp = [[self alloc] init]; 22 | cmp.refreshingBlock = refreshingBlock; 23 | return cmp; 24 | } 25 | + (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action 26 | { 27 | MJRefreshFooter *cmp = [[self alloc] init]; 28 | [cmp setRefreshingTarget:target refreshingAction:action]; 29 | return cmp; 30 | } 31 | 32 | #pragma mark - 重写父类的方法 33 | - (void)prepare 34 | { 35 | [super prepare]; 36 | 37 | // 设置自己的高度 38 | self.mj_h = MJRefreshFooterHeight; 39 | 40 | // 默认不会自动隐藏 41 | self.automaticallyHidden = NO; 42 | } 43 | 44 | - (void)willMoveToSuperview:(UIView *)newSuperview 45 | { 46 | [super willMoveToSuperview:newSuperview]; 47 | 48 | if (newSuperview) { 49 | // 监听scrollView数据的变化 50 | if ([self.scrollView isKindOfClass:[UITableView class]] || [self.scrollView isKindOfClass:[UICollectionView class]]) { 51 | [self.scrollView setMj_reloadDataBlock:^(NSInteger totalDataCount) { 52 | if (self.isAutomaticallyHidden) { 53 | self.hidden = (totalDataCount == 0); 54 | } 55 | }]; 56 | } 57 | } 58 | } 59 | 60 | #pragma mark - 公共方法 61 | - (void)endRefreshingWithNoMoreData 62 | { 63 | MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateNoMoreData;) 64 | } 65 | 66 | - (void)noticeNoMoreData 67 | { 68 | [self endRefreshingWithNoMoreData]; 69 | } 70 | 71 | - (void)resetNoMoreData 72 | { 73 | MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateIdle;) 74 | } 75 | 76 | - (void)setAutomaticallyHidden:(BOOL)automaticallyHidden 77 | { 78 | _automaticallyHidden = automaticallyHidden; 79 | } 80 | @end 81 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/MJRefresh/MJRefresh/Base/MJRefreshHeader.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 | // MJRefreshHeader.m 4 | // MJRefreshExample 5 | // 6 | // Created by MJ Lee on 15/3/4. 7 | // Copyright (c) 2015年 小码哥. All rights reserved. 8 | // 9 | 10 | #import "MJRefreshHeader.h" 11 | 12 | @interface MJRefreshHeader() 13 | @property (assign, nonatomic) CGFloat insetTDelta; 14 | @end 15 | 16 | @implementation MJRefreshHeader 17 | #pragma mark - 构造方法 18 | + (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock 19 | { 20 | MJRefreshHeader *cmp = [[self alloc] init]; 21 | cmp.refreshingBlock = refreshingBlock; 22 | return cmp; 23 | } 24 | + (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action 25 | { 26 | MJRefreshHeader *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 | // 设置key 37 | self.lastUpdatedTimeKey = MJRefreshHeaderLastUpdatedTimeKey; 38 | 39 | // 设置高度 40 | self.mj_h = MJRefreshHeaderHeight; 41 | } 42 | 43 | - (void)placeSubviews 44 | { 45 | [super placeSubviews]; 46 | 47 | // 设置y值(当自己的高度发生改变了,肯定要重新调整Y值,所以放到placeSubviews方法中设置y值) 48 | self.mj_y = - self.mj_h - self.ignoredScrollViewContentInsetTop; 49 | } 50 | 51 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change 52 | { 53 | [super scrollViewContentOffsetDidChange:change]; 54 | 55 | // 在刷新的refreshing状态 56 | if (self.state == MJRefreshStateRefreshing) { 57 | // 暂时保留 58 | if (self.window == nil) return; 59 | 60 | // sectionheader停留解决 61 | CGFloat insetT = - self.scrollView.mj_offsetY > _scrollViewOriginalInset.top ? - self.scrollView.mj_offsetY : _scrollViewOriginalInset.top; 62 | insetT = insetT > self.mj_h + _scrollViewOriginalInset.top ? self.mj_h + _scrollViewOriginalInset.top : insetT; 63 | self.scrollView.mj_insetT = insetT; 64 | 65 | self.insetTDelta = _scrollViewOriginalInset.top - insetT; 66 | return; 67 | } 68 | 69 | // 跳转到下一个控制器时,contentInset可能会变 70 | _scrollViewOriginalInset = self.scrollView.mj_inset; 71 | 72 | // 当前的contentOffset 73 | CGFloat offsetY = self.scrollView.mj_offsetY; 74 | // 头部控件刚好出现的offsetY 75 | CGFloat happenOffsetY = - self.scrollViewOriginalInset.top; 76 | 77 | // 如果是向上滚动到看不见头部控件,直接返回 78 | // >= -> > 79 | if (offsetY > happenOffsetY) return; 80 | 81 | // 普通 和 即将刷新 的临界点 82 | CGFloat normal2pullingOffsetY = happenOffsetY - self.mj_h; 83 | CGFloat pullingPercent = (happenOffsetY - offsetY) / self.mj_h; 84 | 85 | if (self.scrollView.isDragging) { // 如果正在拖拽 86 | self.pullingPercent = pullingPercent; 87 | if (self.state == MJRefreshStateIdle && offsetY < normal2pullingOffsetY) { 88 | // 转为即将刷新状态 89 | self.state = MJRefreshStatePulling; 90 | } else if (self.state == MJRefreshStatePulling && offsetY >= normal2pullingOffsetY) { 91 | // 转为普通状态 92 | self.state = MJRefreshStateIdle; 93 | } 94 | } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开 95 | // 开始刷新 96 | [self beginRefreshing]; 97 | } else if (pullingPercent < 1) { 98 | self.pullingPercent = pullingPercent; 99 | } 100 | } 101 | 102 | - (void)setState:(MJRefreshState)state 103 | { 104 | MJRefreshCheckState 105 | 106 | // 根据状态做事情 107 | if (state == MJRefreshStateIdle) { 108 | if (oldState != MJRefreshStateRefreshing) return; 109 | 110 | // 保存刷新时间 111 | [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:self.lastUpdatedTimeKey]; 112 | [[NSUserDefaults standardUserDefaults] synchronize]; 113 | 114 | // 恢复inset和offset 115 | [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ 116 | self.scrollView.mj_insetT += self.insetTDelta; 117 | 118 | // 自动调整透明度 119 | if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0; 120 | } completion:^(BOOL finished) { 121 | self.pullingPercent = 0.0; 122 | 123 | if (self.endRefreshingCompletionBlock) { 124 | self.endRefreshingCompletionBlock(); 125 | } 126 | }]; 127 | } else if (state == MJRefreshStateRefreshing) { 128 | MJRefreshDispatchAsyncOnMainQueue({ 129 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 130 | if (self.scrollView.panGestureRecognizer.state != UIGestureRecognizerStateCancelled) { 131 | CGFloat top = self.scrollViewOriginalInset.top + self.mj_h; 132 | // 增加滚动区域top 133 | self.scrollView.mj_insetT = top; 134 | // 设置滚动位置 135 | CGPoint offset = self.scrollView.contentOffset; 136 | offset.y = -top; 137 | [self.scrollView setContentOffset:offset animated:NO]; 138 | } 139 | } completion:^(BOOL finished) { 140 | [self executeRefreshingCallback]; 141 | }]; 142 | }) 143 | } 144 | } 145 | 146 | #pragma mark - 公共方法 147 | - (NSDate *)lastUpdatedTime 148 | { 149 | return [[NSUserDefaults standardUserDefaults] objectForKey:self.lastUpdatedTimeKey]; 150 | } 151 | 152 | - (void)setIgnoredScrollViewContentInsetTop:(CGFloat)ignoredScrollViewContentInsetTop { 153 | _ignoredScrollViewContentInsetTop = ignoredScrollViewContentInsetTop; 154 | 155 | self.mj_y = - self.mj_h - _ignoredScrollViewContentInsetTop; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | // 防止动画结束后,状态已经不是MJRefreshStateIdle 94 | if (state != MJRefreshStateIdle) return; 95 | 96 | self.loadingView.alpha = 1.0; 97 | [self.loadingView stopAnimating]; 98 | 99 | self.arrowView.hidden = NO; 100 | }]; 101 | } else { 102 | self.arrowView.hidden = NO; 103 | [self.loadingView stopAnimating]; 104 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 105 | self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI); 106 | }]; 107 | } 108 | } else if (state == MJRefreshStatePulling) { 109 | self.arrowView.hidden = NO; 110 | [self.loadingView stopAnimating]; 111 | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ 112 | self.arrowView.transform = CGAffineTransformIdentity; 113 | }]; 114 | } else if (state == MJRefreshStateRefreshing) { 115 | self.arrowView.hidden = YES; 116 | [self.loadingView startAnimating]; 117 | } else if (state == MJRefreshStateNoMoreData) { 118 | self.arrowView.hidden = YES; 119 | [self.loadingView stopAnimating]; 120 | } 121 | } 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJRefreshStateHeader.m 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 MJRefreshStateHeader() 12 | { 13 | /** 显示上一次刷新时间的label */ 14 | __unsafe_unretained UILabel *_lastUpdatedTimeLabel; 15 | /** 显示刷新状态的label */ 16 | __unsafe_unretained UILabel *_stateLabel; 17 | } 18 | /** 所有状态对应的文字 */ 19 | @property (strong, nonatomic) NSMutableDictionary *stateTitles; 20 | @end 21 | 22 | @implementation MJRefreshStateHeader 23 | #pragma mark - 懒加载 24 | - (NSMutableDictionary *)stateTitles 25 | { 26 | if (!_stateTitles) { 27 | self.stateTitles = [NSMutableDictionary dictionary]; 28 | } 29 | return _stateTitles; 30 | } 31 | 32 | - (UILabel *)stateLabel 33 | { 34 | if (!_stateLabel) { 35 | [self addSubview:_stateLabel = [UILabel mj_label]]; 36 | } 37 | return _stateLabel; 38 | } 39 | 40 | - (UILabel *)lastUpdatedTimeLabel 41 | { 42 | if (!_lastUpdatedTimeLabel) { 43 | [self addSubview:_lastUpdatedTimeLabel = [UILabel mj_label]]; 44 | } 45 | return _lastUpdatedTimeLabel; 46 | } 47 | 48 | #pragma mark - 公共方法 49 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state 50 | { 51 | if (title == nil) return; 52 | self.stateTitles[@(state)] = title; 53 | self.stateLabel.text = self.stateTitles[@(self.state)]; 54 | } 55 | 56 | #pragma mark - 日历获取在9.x之后的系统使用currentCalendar会出异常。在8.0之后使用系统新API。 57 | - (NSCalendar *)currentCalendar { 58 | if ([NSCalendar respondsToSelector:@selector(calendarWithIdentifier:)]) { 59 | return [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian]; 60 | } 61 | return [NSCalendar currentCalendar]; 62 | } 63 | 64 | #pragma mark key的处理 65 | - (void)setLastUpdatedTimeKey:(NSString *)lastUpdatedTimeKey 66 | { 67 | [super setLastUpdatedTimeKey:lastUpdatedTimeKey]; 68 | 69 | // 如果label隐藏了,就不用再处理 70 | if (self.lastUpdatedTimeLabel.hidden) return; 71 | 72 | NSDate *lastUpdatedTime = [[NSUserDefaults standardUserDefaults] objectForKey:lastUpdatedTimeKey]; 73 | 74 | // 如果有block 75 | if (self.lastUpdatedTimeText) { 76 | self.lastUpdatedTimeLabel.text = self.lastUpdatedTimeText(lastUpdatedTime); 77 | return; 78 | } 79 | 80 | if (lastUpdatedTime) { 81 | // 1.获得年月日 82 | NSCalendar *calendar = [self currentCalendar]; 83 | NSUInteger unitFlags = NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay |NSCalendarUnitHour |NSCalendarUnitMinute; 84 | NSDateComponents *cmp1 = [calendar components:unitFlags fromDate:lastUpdatedTime]; 85 | NSDateComponents *cmp2 = [calendar components:unitFlags fromDate:[NSDate date]]; 86 | 87 | // 2.格式化日期 88 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 89 | BOOL isToday = NO; 90 | if ([cmp1 day] == [cmp2 day]) { // 今天 91 | formatter.dateFormat = @" HH:mm"; 92 | isToday = YES; 93 | } else if ([cmp1 year] == [cmp2 year]) { // 今年 94 | formatter.dateFormat = @"MM-dd HH:mm"; 95 | } else { 96 | formatter.dateFormat = @"yyyy-MM-dd HH:mm"; 97 | } 98 | NSString *time = [formatter stringFromDate:lastUpdatedTime]; 99 | 100 | // 3.显示日期 101 | self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@"%@%@%@", 102 | [NSBundle mj_localizedStringForKey:MJRefreshHeaderLastTimeText], 103 | isToday ? [NSBundle mj_localizedStringForKey:MJRefreshHeaderDateTodayText] : @"", 104 | time]; 105 | } else { 106 | self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@"%@%@", 107 | [NSBundle mj_localizedStringForKey:MJRefreshHeaderLastTimeText], 108 | [NSBundle mj_localizedStringForKey:MJRefreshHeaderNoneLastDateText]]; 109 | } 110 | } 111 | 112 | #pragma mark - 覆盖父类的方法 113 | - (void)prepare 114 | { 115 | [super prepare]; 116 | 117 | // 初始化间距 118 | self.labelLeftInset = MJRefreshLabelLeftInset; 119 | 120 | // 初始化文字 121 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderIdleText] forState:MJRefreshStateIdle]; 122 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderPullingText] forState:MJRefreshStatePulling]; 123 | [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderRefreshingText] forState:MJRefreshStateRefreshing]; 124 | } 125 | 126 | - (void)placeSubviews 127 | { 128 | [super placeSubviews]; 129 | 130 | if (self.stateLabel.hidden) return; 131 | 132 | BOOL noConstrainsOnStatusLabel = self.stateLabel.constraints.count == 0; 133 | 134 | if (self.lastUpdatedTimeLabel.hidden) { 135 | // 状态 136 | if (noConstrainsOnStatusLabel) self.stateLabel.frame = self.bounds; 137 | } else { 138 | CGFloat stateLabelH = self.mj_h * 0.5; 139 | // 状态 140 | if (noConstrainsOnStatusLabel) { 141 | self.stateLabel.mj_x = 0; 142 | self.stateLabel.mj_y = 0; 143 | self.stateLabel.mj_w = self.mj_w; 144 | self.stateLabel.mj_h = stateLabelH; 145 | } 146 | 147 | // 更新时间 148 | if (self.lastUpdatedTimeLabel.constraints.count == 0) { 149 | self.lastUpdatedTimeLabel.mj_x = 0; 150 | self.lastUpdatedTimeLabel.mj_y = stateLabelH; 151 | self.lastUpdatedTimeLabel.mj_w = self.mj_w; 152 | self.lastUpdatedTimeLabel.mj_h = self.mj_h - self.lastUpdatedTimeLabel.mj_y; 153 | } 154 | } 155 | } 156 | 157 | - (void)setState:(MJRefreshState)state 158 | { 159 | MJRefreshCheckState 160 | 161 | // 设置状态文字 162 | self.stateLabel.text = self.stateTitles[@(state)]; 163 | 164 | // 重新设置key(重新显示时间) 165 | self.lastUpdatedTimeKey = self.lastUpdatedTimeKey; 166 | } 167 | @end 168 | -------------------------------------------------------------------------------- /Example/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aflyingfish01/HBTableViewFrameWork/044c9f412b0e1fecd8ad0f1c49ea62b8482c2858/Example/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/arrow@2x.png -------------------------------------------------------------------------------- /Example/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "MJRefreshHeaderIdleText" = "Pull down to refresh"; 2 | "MJRefreshHeaderPullingText" = "Release to refresh"; 3 | "MJRefreshHeaderRefreshingText" = "Loading..."; 4 | 5 | "MJRefreshAutoFooterIdleText" = "Tap or pull up to load more"; 6 | "MJRefreshAutoFooterRefreshingText" = "Loading..."; 7 | "MJRefreshAutoFooterNoMoreDataText" = "No more data"; 8 | 9 | "MJRefreshBackFooterIdleText" = "Pull up to load more"; 10 | "MJRefreshBackFooterPullingText" = "Release to load more."; 11 | "MJRefreshBackFooterRefreshingText" = "Loading..."; 12 | "MJRefreshBackFooterNoMoreDataText" = "No more data"; 13 | 14 | "MJRefreshHeaderLastTimeText" = "Last updated: "; 15 | "MJRefreshHeaderDateTodayText" = "Today"; 16 | "MJRefreshHeaderNoneLastDateText" = "No record"; 17 | -------------------------------------------------------------------------------- /Example/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aflyingfish01/HBTableViewFrameWork/044c9f412b0e1fecd8ad0f1c49ea62b8482c2858/Example/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/zh-Hans.lproj/Localizable.strings -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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" -------------------------------------------------------------------------------- /Example/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 | 69 | // 异步主线程执行,不强持有Self 70 | #define MJRefreshDispatchAsyncOnMainQueue(x) \ 71 | __weak typeof(self) weakSelf = self; \ 72 | dispatch_async(dispatch_get_main_queue(), ^{ \ 73 | typeof(weakSelf) self = weakSelf; \ 74 | {x} \ 75 | }); 76 | 77 | -------------------------------------------------------------------------------- /Example/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"; -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | #pragma clang diagnostic push 14 | #pragma clang diagnostic ignored "-Wunguarded-availability-new" 15 | 16 | @implementation UIScrollView (MJExtension) 17 | 18 | static BOOL respondsToAdjustedContentInset_; 19 | 20 | + (void)initialize 21 | { 22 | static dispatch_once_t onceToken; 23 | dispatch_once(&onceToken, ^{ 24 | respondsToAdjustedContentInset_ = [self instancesRespondToSelector:@selector(adjustedContentInset)]; 25 | }); 26 | } 27 | 28 | - (UIEdgeInsets)mj_inset 29 | { 30 | #ifdef __IPHONE_11_0 31 | if (respondsToAdjustedContentInset_) { 32 | return self.adjustedContentInset; 33 | } 34 | #endif 35 | return self.contentInset; 36 | } 37 | 38 | - (void)setMj_insetT:(CGFloat)mj_insetT 39 | { 40 | UIEdgeInsets inset = self.contentInset; 41 | inset.top = mj_insetT; 42 | #ifdef __IPHONE_11_0 43 | if (respondsToAdjustedContentInset_) { 44 | inset.top -= (self.adjustedContentInset.top - self.contentInset.top); 45 | } 46 | #endif 47 | self.contentInset = inset; 48 | } 49 | 50 | - (CGFloat)mj_insetT 51 | { 52 | return self.mj_inset.top; 53 | } 54 | 55 | - (void)setMj_insetB:(CGFloat)mj_insetB 56 | { 57 | UIEdgeInsets inset = self.contentInset; 58 | inset.bottom = mj_insetB; 59 | #ifdef __IPHONE_11_0 60 | if (respondsToAdjustedContentInset_) { 61 | inset.bottom -= (self.adjustedContentInset.bottom - self.contentInset.bottom); 62 | } 63 | #endif 64 | self.contentInset = inset; 65 | } 66 | 67 | - (CGFloat)mj_insetB 68 | { 69 | return self.mj_inset.bottom; 70 | } 71 | 72 | - (void)setMj_insetL:(CGFloat)mj_insetL 73 | { 74 | UIEdgeInsets inset = self.contentInset; 75 | inset.left = mj_insetL; 76 | #ifdef __IPHONE_11_0 77 | if (respondsToAdjustedContentInset_) { 78 | inset.left -= (self.adjustedContentInset.left - self.contentInset.left); 79 | } 80 | #endif 81 | self.contentInset = inset; 82 | } 83 | 84 | - (CGFloat)mj_insetL 85 | { 86 | return self.mj_inset.left; 87 | } 88 | 89 | - (void)setMj_insetR:(CGFloat)mj_insetR 90 | { 91 | UIEdgeInsets inset = self.contentInset; 92 | inset.right = mj_insetR; 93 | #ifdef __IPHONE_11_0 94 | if (respondsToAdjustedContentInset_) { 95 | inset.right -= (self.adjustedContentInset.right - self.contentInset.right); 96 | } 97 | #endif 98 | self.contentInset = inset; 99 | } 100 | 101 | - (CGFloat)mj_insetR 102 | { 103 | return self.mj_inset.right; 104 | } 105 | 106 | - (void)setMj_offsetX:(CGFloat)mj_offsetX 107 | { 108 | CGPoint offset = self.contentOffset; 109 | offset.x = mj_offsetX; 110 | self.contentOffset = offset; 111 | } 112 | 113 | - (CGFloat)mj_offsetX 114 | { 115 | return self.contentOffset.x; 116 | } 117 | 118 | - (void)setMj_offsetY:(CGFloat)mj_offsetY 119 | { 120 | CGPoint offset = self.contentOffset; 121 | offset.y = mj_offsetY; 122 | self.contentOffset = offset; 123 | } 124 | 125 | - (CGFloat)mj_offsetY 126 | { 127 | return self.contentOffset.y; 128 | } 129 | 130 | - (void)setMj_contentW:(CGFloat)mj_contentW 131 | { 132 | CGSize size = self.contentSize; 133 | size.width = mj_contentW; 134 | self.contentSize = size; 135 | } 136 | 137 | - (CGFloat)mj_contentW 138 | { 139 | return self.contentSize.width; 140 | } 141 | 142 | - (void)setMj_contentH:(CGFloat)mj_contentH 143 | { 144 | CGSize size = self.contentSize; 145 | size.height = mj_contentH; 146 | self.contentSize = size; 147 | } 148 | 149 | - (CGFloat)mj_contentH 150 | { 151 | return self.contentSize.height; 152 | } 153 | @end 154 | #pragma clang diagnostic pop 155 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | objc_setAssociatedObject(self, &MJRefreshHeaderKey, 42 | mj_header, OBJC_ASSOCIATION_RETAIN); 43 | } 44 | } 45 | 46 | - (MJRefreshHeader *)mj_header 47 | { 48 | return objc_getAssociatedObject(self, &MJRefreshHeaderKey); 49 | } 50 | 51 | #pragma mark - footer 52 | static const char MJRefreshFooterKey = '\0'; 53 | - (void)setMj_footer:(MJRefreshFooter *)mj_footer 54 | { 55 | if (mj_footer != self.mj_footer) { 56 | // 删除旧的,添加新的 57 | [self.mj_footer removeFromSuperview]; 58 | [self insertSubview:mj_footer atIndex:0]; 59 | 60 | // 存储新的 61 | objc_setAssociatedObject(self, &MJRefreshFooterKey, 62 | mj_footer, OBJC_ASSOCIATION_RETAIN); 63 | } 64 | } 65 | 66 | - (MJRefreshFooter *)mj_footer 67 | { 68 | return objc_getAssociatedObject(self, &MJRefreshFooterKey); 69 | } 70 | 71 | #pragma mark - 过期 72 | - (void)setFooter:(MJRefreshFooter *)footer 73 | { 74 | self.mj_footer = footer; 75 | } 76 | 77 | - (MJRefreshFooter *)footer 78 | { 79 | return self.mj_footer; 80 | } 81 | 82 | - (void)setHeader:(MJRefreshHeader *)header 83 | { 84 | self.mj_header = header; 85 | } 86 | 87 | - (MJRefreshHeader *)header 88 | { 89 | return self.mj_header; 90 | } 91 | 92 | #pragma mark - other 93 | - (NSInteger)mj_totalDataCount 94 | { 95 | NSInteger totalCount = 0; 96 | if ([self isKindOfClass:[UITableView class]]) { 97 | UITableView *tableView = (UITableView *)self; 98 | 99 | 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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HBTableViewFrameWork (0.1.7) 3 | - MJRefresh (3.1.15.7) 4 | 5 | DEPENDENCIES: 6 | - HBTableViewFrameWork (from `../`) 7 | - MJRefresh (~> 3.1.15.7) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - MJRefresh 12 | 13 | EXTERNAL SOURCES: 14 | HBTableViewFrameWork: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | HBTableViewFrameWork: 2fca9a13dc34e96c213d0b6e29f5b160e00292c0 19 | MJRefresh: 697f8ec75ebdbe9207767bb682cf0f51b0d8a41f 20 | 21 | PODFILE CHECKSUM: 5ffe661366bbd8fc2c2bbf16fd41eb1dc2f47b58 22 | 23 | COCOAPODS: 1.7.5 24 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HBTableViewFrameWork/HBTableViewFrameWork-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 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.7 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HBTableViewFrameWork/HBTableViewFrameWork-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_HBTableViewFrameWork : NSObject 3 | @end 4 | @implementation PodsDummy_HBTableViewFrameWork 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HBTableViewFrameWork/HBTableViewFrameWork-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HBTableViewFrameWork/HBTableViewFrameWork-umbrella.h: -------------------------------------------------------------------------------- 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 | #import "HBTableViewBaseViewClass.h" 14 | #import "HBTableViewBaseViewProtocol.h" 15 | #import "HBTableViewDataSource.h" 16 | #import "HBTableViewListFrame.h" 17 | #import "HBTableViewSectionModelClass.h" 18 | #import "HBTableViewSectionModelProtocol.h" 19 | #import "HBTableViewSectionViewModel.h" 20 | #import "HBTableViewSectionViewModelProtocol.h" 21 | 22 | FOUNDATION_EXPORT double HBTableViewFrameWorkVersionNumber; 23 | FOUNDATION_EXPORT const unsigned char HBTableViewFrameWorkVersionString[]; 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HBTableViewFrameWork/HBTableViewFrameWork.modulemap: -------------------------------------------------------------------------------- 1 | framework module HBTableViewFrameWork { 2 | umbrella header "HBTableViewFrameWork-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HBTableViewFrameWork/HBTableViewFrameWork.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MJRefresh/MJRefresh-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 | FMWK 17 | CFBundleShortVersionString 18 | 3.1.15 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MJRefresh/MJRefresh-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_MJRefresh : NSObject 3 | @end 4 | @implementation PodsDummy_MJRefresh 5 | @end 6 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MJRefresh/MJRefresh-umbrella.h: -------------------------------------------------------------------------------- 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 | #import "MJRefreshAutoFooter.h" 14 | #import "MJRefreshBackFooter.h" 15 | #import "MJRefreshComponent.h" 16 | #import "MJRefreshFooter.h" 17 | #import "MJRefreshHeader.h" 18 | #import "MJRefreshAutoGifFooter.h" 19 | #import "MJRefreshAutoNormalFooter.h" 20 | #import "MJRefreshAutoStateFooter.h" 21 | #import "MJRefreshBackGifFooter.h" 22 | #import "MJRefreshBackNormalFooter.h" 23 | #import "MJRefreshBackStateFooter.h" 24 | #import "MJRefreshGifHeader.h" 25 | #import "MJRefreshNormalHeader.h" 26 | #import "MJRefreshStateHeader.h" 27 | #import "MJRefresh.h" 28 | #import "MJRefreshConst.h" 29 | #import "NSBundle+MJRefresh.h" 30 | #import "UIScrollView+MJExtension.h" 31 | #import "UIScrollView+MJRefresh.h" 32 | #import "UIView+MJExtension.h" 33 | 34 | FOUNDATION_EXPORT double MJRefreshVersionNumber; 35 | FOUNDATION_EXPORT const unsigned char MJRefreshVersionString[]; 36 | 37 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MJRefresh/MJRefresh.modulemap: -------------------------------------------------------------------------------- 1 | framework module MJRefresh { 2 | umbrella header "MJRefresh-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MJRefresh/MJRefresh.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/MJRefresh 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example-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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## HBTableViewFrameWork 5 | 6 | Copyright (c) 2019 hulailin 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 | ## MJRefresh 28 | 29 | Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh) 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 | Generated by CocoaPods - https://cocoapods.org 50 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example-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) 2019 hulailin <hulailin@touker.com> 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 | HBTableViewFrameWork 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh) 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 | 66 | License 67 | MIT 68 | Title 69 | MJRefresh 70 | Type 71 | PSGroupSpecifier 72 | 73 | 74 | FooterText 75 | Generated by CocoaPods - https://cocoapods.org 76 | Title 77 | 78 | Type 79 | PSGroupSpecifier 80 | 81 | 82 | StringsTable 83 | Acknowledgements 84 | Title 85 | Acknowledgements 86 | 87 | 88 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_HBTableViewFrameWork_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_HBTableViewFrameWork_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 90 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/HBTableViewFrameWork/HBTableViewFrameWork.framework" 165 | install_framework "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework" 166 | fi 167 | if [[ "$CONFIGURATION" == "Release" ]]; then 168 | install_framework "${BUILT_PRODUCTS_DIR}/HBTableViewFrameWork/HBTableViewFrameWork.framework" 169 | install_framework "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework" 170 | fi 171 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 172 | wait 173 | fi 174 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example-umbrella.h: -------------------------------------------------------------------------------- 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 | 14 | FOUNDATION_EXPORT double Pods_HBTableViewFrameWork_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_HBTableViewFrameWork_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork/HBTableViewFrameWork.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh/MJRefresh.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "HBTableViewFrameWork" -framework "MJRefresh" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_HBTableViewFrameWork_Example { 2 | umbrella header "Pods-HBTableViewFrameWork_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Example/Pods-HBTableViewFrameWork_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork/HBTableViewFrameWork.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh/MJRefresh.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "HBTableViewFrameWork" -framework "MJRefresh" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests-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 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_HBTableViewFrameWork_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_HBTableViewFrameWork_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests-umbrella.h: -------------------------------------------------------------------------------- 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 | 14 | FOUNDATION_EXPORT double Pods_HBTableViewFrameWork_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_HBTableViewFrameWork_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork/HBTableViewFrameWork.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh/MJRefresh.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "HBTableViewFrameWork" -framework "MJRefresh" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_HBTableViewFrameWork_Tests { 2 | umbrella header "Pods-HBTableViewFrameWork_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-HBTableViewFrameWork_Tests/Pods-HBTableViewFrameWork_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HBTableViewFrameWork/HBTableViewFrameWork.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh/MJRefresh.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "HBTableViewFrameWork" -framework "MJRefresh" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewFrameWorkTests.m 3 | // HBTableViewFrameWorkTests 4 | // 5 | // Created by hulailin on 01/10/2019. 6 | // Copyright (c) 2019 hulailin. All rights reserved. 7 | // 8 | 9 | @import XCTest; 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /HBTableViewFrameWork.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = 'HBTableViewFrameWork' 4 | s.version = '0.1.8' 5 | s.summary = '快速搭建表格框架' 6 | s.description = <<-DESC 7 | 快速搭建表格框架 8 | DESC 9 | 10 | s.homepage = 'https://github.com/hulailin/HBTableViewFrameWork' 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { 'hulailin' => 'hulailin@126.com' } 13 | s.source = { :git => 'https://github.com/hulailin/HBTableViewFrameWork.git', :tag => s.version.to_s } 14 | s.ios.deployment_target = '8.0' 15 | 16 | s.source_files = 'HBTableViewFrameWork/Classes/**/*' 17 | 18 | # s.resource_bundles = { 19 | # 'HBTableViewFrameWork' => ['HBTableViewFrameWork/Assets/*.png'] 20 | # } 21 | 22 | # s.public_header_files = 'Pod/Classes/**/*.h' 23 | # s.frameworks = 'UIKit', 'MapKit' 24 | # s.dependency 'AFNetworking', '~> 2.3' 25 | end 26 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aflyingfish01/HBTableViewFrameWork/044c9f412b0e1fecd8ad0f1c49ea62b8482c2858/HBTableViewFrameWork/Assets/.gitkeep -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aflyingfish01/HBTableViewFrameWork/044c9f412b0e1fecd8ad0f1c49ea62b8482c2858/HBTableViewFrameWork/Classes/.gitkeep -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewBaseViewClass.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewBaseViewClass.h 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hbzq on 2019/1/17. 6 | // 7 | 8 | #import 9 | #import "HBTableViewBaseViewProtocol.h" 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface HBTableViewBaseViewClass : UIView 13 | 14 | + (instancetype)createViewWithNibName:(NSString *)nibName className:(NSString *)className; 15 | @end 16 | 17 | 18 | @interface HBTableViewBaseCell : UITableViewCell 19 | 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewBaseViewClass.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewBaseViewClass.m 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hbzq on 2019/1/17. 6 | // 7 | 8 | #import "HBTableViewBaseViewClass.h" 9 | 10 | @implementation HBTableViewBaseViewClass 11 | 12 | 13 | + (instancetype)createViewWithNibName:(NSString *)nibName className:(NSString *)className{ 14 | return (HBTableViewBaseViewClass *)[HBTableViewBaseViewClass getNibViewWithNibName:nibName className:className]; 15 | } 16 | 17 | 18 | + (UIView *)getNibViewWithNibName:(NSString *)nibName className:(NSString *)className{ 19 | if (className != nil) { 20 | return [[NSClassFromString(className) alloc] init]; 21 | }else if (nibName != nil){ 22 | return [[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil][0]; 23 | } 24 | return nil; 25 | } 26 | 27 | 28 | - (void)fillData:(id)data{} 29 | @end 30 | 31 | 32 | @interface HBTableViewBaseCell () 33 | @property (nonatomic, strong, readwrite) NSIndexPath *indexPath; 34 | 35 | @end 36 | 37 | @implementation HBTableViewBaseCell 38 | 39 | #pragma mark - Live Method 40 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 41 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 42 | 43 | } 44 | return self; 45 | } 46 | 47 | - (void)awakeFromNib { 48 | [super awakeFromNib]; 49 | } 50 | 51 | 52 | #pragma mark - private methods(私有方法) 53 | 54 | - (void)updateWithCellData:(id)aData{} 55 | 56 | @end 57 | 58 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewBaseViewProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewSectionViewModelProtocol.h 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/16. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HBTableViewSectionModelProtocol.h" 11 | @protocol HBTableViewBaseViewProtocol 12 | - (void)fillData:(id)data; 13 | @end 14 | @protocol HBTableViewBaseCellProtocol 15 | 16 | /** 17 | 更新cell数据 18 | 19 | @param aData model 20 | */ 21 | - (void)updateWithCellData:(id)aData; 22 | @end 23 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableDataSource.h 3 | // HBListTableControll_Example 4 | // 5 | // Copyright © 2018年 lishuailibertine. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | @interface HBTableViewDataSource : NSObject 12 | 13 | /** 14 | 存放的是的转化好的框架的模型 15 | */ 16 | @property (nonatomic, strong) NSMutableArray *modelViewArray; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableDataSource.m 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTableViewDataSource.h" 10 | #import "HBTableViewSectionViewModel.h" 11 | #import "HBTableViewBaseViewProtocol.h" 12 | #import "HBTableViewBaseViewClass.h" 13 | @interface HBTableViewDataSource() 14 | 15 | @end 16 | @implementation HBTableViewDataSource 17 | 18 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 19 | if (self.modelViewArray) { 20 | return self.modelViewArray.count; 21 | }return 0; 22 | } 23 | 24 | 25 | #pragma mark - tableViewDelegate tableViewDataSource 26 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ 27 | id sectionModel =[self.modelViewArray objectAtIndex:section]; 28 | return sectionModel.configSectionHeaderHeight?sectionModel.configSectionHeaderHeight(section):0.01; 29 | } 30 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ 31 | id sectionModel =[self.modelViewArray objectAtIndex:section]; 32 | return sectionModel.configSectionFooterHeight?sectionModel.configSectionFooterHeight(section):0.01; 33 | } 34 | - (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ 35 | id sectionModel =[self.modelViewArray objectAtIndex:section]; 36 | id sectionView =nil; 37 | sectionView = sectionModel.configSectionHeaderView?sectionModel.configSectionHeaderView(tableView,section):( id)[[UIView alloc] init]; 38 | if (sectionModel.configSectionHeaderData) { 39 | sectionModel.configSectionHeaderData(tableView, section, sectionView, sectionModel.sectionHeaderData); 40 | } 41 | return (UIView *)sectionView; 42 | } 43 | - (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;{ 44 | id sectionModel =[self.modelViewArray objectAtIndex:section]; 45 | id footerView =nil; 46 | footerView = sectionModel.configFooterView?sectionModel.configFooterView(tableView,section):(id)[[UIView alloc] init]; 47 | if (sectionModel.configSectionFooterData) { 48 | sectionModel.configSectionFooterData(tableView, section, footerView, sectionModel.sectionFooterData); 49 | 50 | } 51 | return (UIView *)footerView; 52 | } 53 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 54 | id sectionModel =[self.modelViewArray objectAtIndex:section]; 55 | return sectionModel.rowDataArray.count; 56 | } 57 | 58 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 59 | 60 | id sectionModel =[self.modelViewArray objectAtIndex:indexPath.section]; 61 | id cellModel =[sectionModel.rowDataArray objectAtIndex:indexPath.row]; 62 | 63 | UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellModel.className]; 64 | if (!cell) { 65 | if(cellModel.isNib){ 66 | cell =[[NSBundle mainBundle] loadNibNamed:cellModel.className owner:nil options:nil][0]; 67 | }else{ 68 | cell = [[NSClassFromString(cellModel.className) alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellModel.className]; 69 | } 70 | } 71 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 72 | 73 | if (cellModel.configCellData) { 74 | cellModel.configCellData((id)cell, cellModel.rowData); 75 | } 76 | 77 | return cell; 78 | } 79 | 80 | /** 81 | cell 点击响应f 82 | 83 | @param tableView tableView 84 | @param indexPath indexPath 85 | */ 86 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 87 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 88 | id sectionModel =[self.modelViewArray objectAtIndex:indexPath.section]; 89 | id rowModel =[sectionModel.rowDataArray objectAtIndex:indexPath.row]; 90 | if (rowModel.didSelectRowAtIndexPath) { 91 | rowModel.didSelectRowAtIndexPath(tableView, indexPath, rowModel); 92 | } 93 | 94 | } 95 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 96 | id sectionModel =[self.modelViewArray objectAtIndex:indexPath.section]; 97 | id rowModel =[sectionModel.rowDataArray objectAtIndex:indexPath.row]; 98 | return rowModel.configRowHeight?rowModel.configRowHeight(indexPath):0; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewListFrame.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewListFrame.h 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hbzq on 2019/1/15. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | /** 12 | 配置cell的数据 13 | 14 | @param cell cell 15 | @param model 模型 16 | */ 17 | typedef void (^configCellBlock)(id cell, id model); 18 | 19 | /** 20 | cell 点击的响应事件 21 | 22 | @param tableView 表 23 | @param indexPath path 24 | @param rowData 数据 25 | */ 26 | typedef void(^didSelectRowAtIndexPath)(UITableView *tableView,NSIndexPath *indexPath,id rowData); 27 | 28 | @interface HBTableViewListFrame : NSObject 29 | 30 | /** 31 | 初始化框架 32 | 33 | @param tableView tableView 34 | @return 对象 35 | */ 36 | + (instancetype)tableViewListFrame:(UITableView *)tableView; 37 | 38 | - (void)updateListWithModels:(id)dataArray dataConfigBlock:(configCellBlock)block didSelectRowAtIndexPath:(didSelectRowAtIndexPath)didSelectRowAtIndexPath; 39 | 40 | - (void)updateListWithSectionModels:(id)dataArray dataConfigBlock:(configCellBlock)block didSelectRowAtIndexPath:(didSelectRowAtIndexPath)didSelectRowAtIndexPath; 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewListFrame.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewListFrame.m 3 | // HBTableViewFrameWork 4 | // 5 | // Created by hbzq on 2019/1/15. 6 | // 7 | 8 | #import "HBTableViewListFrame.h" 9 | #import "HBTableViewSectionViewModel.h" 10 | #import "HBTableViewBaseViewClass.h" 11 | #import "HBTableViewDataSource.h" 12 | 13 | /** 14 | 配置cell的数据 15 | 16 | @param cell cell 17 | @param model model 18 | */ 19 | typedef void (^configCellBlock)(id cell, id model); 20 | 21 | /** 22 | cell 点击的响应事件 23 | 24 | @param tableView 表 25 | @param indexPath path 26 | @param rowData 数据 27 | */ 28 | typedef void(^didSelectRowAtIndexPath)(UITableView *tableView,NSIndexPath *indexPath,id rowData); 29 | 30 | @interface HBTableViewListFrame() 31 | @property (nonatomic, strong) HBTableViewDataSource *dataSource; 32 | @property (nonatomic, weak) UITableView *tableView; 33 | 34 | /** 填充数据的block*/ 35 | @property (nonatomic,copy) configCellBlock configBlock; 36 | 37 | /** 响应事件*/ 38 | @property (nonatomic ,copy) didSelectRowAtIndexPath didSelectRowAtIndexPath; 39 | 40 | @end 41 | 42 | @implementation HBTableViewListFrame 43 | 44 | 45 | + (instancetype)tableViewListFrame:(UITableView *)tableView{ 46 | HBTableViewListFrame *tableList = [[HBTableViewListFrame alloc] init]; 47 | tableList.tableView = tableView; 48 | tableView.delegate = tableList.dataSource; 49 | tableView.dataSource = tableList.dataSource; 50 | return tableList; 51 | } 52 | 53 | - (void)updateListWithModels:(id)dataArray dataConfigBlock:(configCellBlock)block didSelectRowAtIndexPath:(didSelectRowAtIndexPath)didSelectRowAtIndexPath{ 54 | self.dataSource.modelViewArray = [self requestTableDataArray:dataArray]; 55 | self.configBlock = block; 56 | self.didSelectRowAtIndexPath = didSelectRowAtIndexPath; 57 | [self.tableView reloadData]; 58 | } 59 | - (void)updateListWithSectionModels:(id)dataArray dataConfigBlock:(configCellBlock)block didSelectRowAtIndexPath:(didSelectRowAtIndexPath)didSelectRowAtIndexPath{ 60 | self.dataSource.modelViewArray = [self requestTableSectionDataArray:dataArray]; 61 | self.configBlock = block; 62 | self.didSelectRowAtIndexPath = didSelectRowAtIndexPath; 63 | [self.tableView reloadData]; 64 | } 65 | 66 | //数组的数据整理 67 | - (NSMutableArray *)requestTableDataArray:(id)dataArray{ 68 | NSMutableArray *array = [NSMutableArray array]; 69 | HBTableViewSectionViewModel *sectionModel =[[HBTableViewSectionViewModel alloc] init]; 70 | NSMutableArray *list = (NSMutableArray *)dataArray; 71 | [list enumerateObjectsUsingBlock:^(id _Nonnull objRow, NSUInteger idx, BOOL * _Nonnull stop) { 72 | 73 | HBTableViewCellViewModel *cellModel = [[HBTableViewCellViewModel alloc] init]; 74 | [cellModel setClassName:objRow.cellReusable]; 75 | [cellModel setConfigRowHeight:^CGFloat(NSIndexPath *indexPath) { 76 | return objRow.rowHeight; 77 | }]; 78 | [cellModel setIsNib:objRow.isNib]; 79 | [cellModel setConfigCellData:^(id cell, id cellModel) { 80 | //绑定数据源 如果响应方法 说明继承了基类 系统自动实现方法 81 | if ([cell respondsToSelector:@selector(updateWithCellData:)]) { 82 | [cell updateWithCellData:cellModel]; 83 | 84 | } 85 | //这个block是cel的回调 用来自定义 86 | if (self.configBlock) { 87 | self.configBlock(cell,cellModel); 88 | } 89 | 90 | }]; 91 | [cellModel setDidSelectRowAtIndexPath:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath, id _Nonnull rowData) { 92 | if (self.didSelectRowAtIndexPath) { 93 | self.didSelectRowAtIndexPath(tableView,indexPath,rowData); 94 | } 95 | }]; 96 | 97 | cellModel.rowData = objRow; 98 | [sectionModel.rowDataArray addObject:cellModel]; 99 | }]; 100 | [array addObject:sectionModel]; 101 | 102 | return array; 103 | } 104 | //二维数组的数据整理 105 | - (NSMutableArray *)requestTableSectionDataArray:(id)dataArray { 106 | 107 | NSMutableArray *sectionModels = [NSMutableArray array]; 108 | 109 | NSMutableArray *list = (NSMutableArray *)dataArray; 110 | __weak typeof(self)weakSelf = self; 111 | [list enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 112 | __strong typeof(weakSelf)self = weakSelf; 113 | HBTableViewSectionViewModel *sectionModel =[[HBTableViewSectionViewModel alloc] init]; 114 | 115 | [sectionModel setConfigSectionHeaderHeight:^CGFloat(NSInteger section) { 116 | return obj.sectionHeaderHeight ? obj.sectionHeaderHeight:0.f; 117 | }]; 118 | [sectionModel setConfigSectionHeaderView:^id (UITableView *tableView, NSInteger section) { 119 | return [self configHeaderView:tableView section:section obj:obj]; 120 | }]; 121 | [sectionModel setConfigSectionHeaderData:^(UITableView *tableView, NSInteger section, id view, id sectionData) { 122 | [self configHeaderData:tableView section:section headerView:view sectionData:sectionData]; 123 | }]; 124 | 125 | [sectionModel setConfigSectionFooterHeight:^CGFloat(NSInteger section) { 126 | return obj.sectionFooterHeight ? obj.sectionFooterHeight:0; 127 | }]; 128 | [sectionModel setConfigFooterView:^id(UITableView *tableView, NSInteger section) { 129 | return [self configFooterView:tableView section:section obj:obj]; 130 | }]; 131 | [sectionModel setConfigSectionFooterData:^(UITableView *tableView, NSInteger section, id view, id footerData) { 132 | [self configFooterData:tableView section:section footerView:view footerData:footerData]; 133 | }]; 134 | 135 | sectionModel.sectionHeaderData = obj; 136 | sectionModel.sectionFooterData = obj; 137 | [obj.rowArray enumerateObjectsUsingBlock:^(id _Nonnull objRow, NSUInteger idx, BOOL * _Nonnull stop) { 138 | 139 | HBTableViewCellViewModel *cellModel = [[HBTableViewCellViewModel alloc] init]; 140 | [cellModel setClassName:objRow.cellReusable]; 141 | [cellModel setConfigRowHeight:^CGFloat(NSIndexPath *indexPath) { 142 | return objRow.rowHeight; 143 | }]; 144 | [cellModel setIsNib:objRow.isNib]; 145 | [cellModel setConfigCellData:^(id cell, id cellModel) { 146 | //绑定数据源 147 | if ([cell respondsToSelector:@selector(updateWithCellData:)]) { 148 | [cell updateWithCellData:cellModel]; 149 | } 150 | //这个block是cel的回调 用来自定义 151 | if (self.configBlock) { 152 | self.configBlock(cell,cellModel); 153 | } 154 | }]; 155 | [cellModel setDidSelectRowAtIndexPath:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath, id _Nonnull rowData) { 156 | if (self.didSelectRowAtIndexPath) { 157 | self.didSelectRowAtIndexPath(tableView,indexPath,rowData); 158 | } 159 | }]; 160 | cellModel.rowData = objRow; 161 | [sectionModel.rowDataArray addObject:cellModel]; 162 | }]; 163 | [sectionModels addObject:sectionModel]; 164 | }]; 165 | return sectionModels; 166 | } 167 | 168 | 169 | #pragma mark - private methods(私有方法) 170 | 171 | - (id)configHeaderView:(UITableView *)tableView section:(NSInteger)section obj:(id)obj{ 172 | id headerView = [HBTableViewBaseViewClass createViewWithNibName:obj.nibHeaderName className:obj.viewHeaderClass]; 173 | return headerView; 174 | } 175 | 176 | - (void)configHeaderData:(UITableView *)tableView section:(NSInteger)section headerView:(id)headerView sectionData:(id)sectionData{ 177 | [headerView fillData:sectionData]; 178 | } 179 | 180 | 181 | - (id)configFooterView:(UITableView *)tableView section:(NSInteger)section obj:(id)obj{ 182 | id footerView = [HBTableViewBaseViewClass createViewWithNibName:obj.nibFooterName className:obj.viewHeaderClass]; 183 | return footerView; 184 | } 185 | - (void)configFooterData:(UITableView *)tableView section:(NSInteger)section footerView:(id)footerView footerData:(id)footerData{ 186 | [footerView fillData:footerData]; 187 | } 188 | #pragma mark - getters and setters 189 | 190 | - (HBTableViewDataSource *)dataSource{ 191 | if (!_dataSource) { 192 | _dataSource = [[HBTableViewDataSource alloc] init]; 193 | } 194 | return _dataSource; 195 | } 196 | @end 197 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewSectionModelClass.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewBaseModel.h 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/16. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "HBTableViewSectionModelProtocol.h" 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** 15 | 遵守协议的父类 16 | */ 17 | @interface HBTableViewCellModelClass: NSObject 18 | 19 | @end 20 | 21 | @interface HBTableViewSectionModelClass: NSObject 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewSectionModelClass.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewBaseModel.m 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/16. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTableViewSectionModelClass.h" 10 | 11 | @implementation HBTableViewCellModelClass 12 | @synthesize cellReusable,rowHeight,isNib; 13 | 14 | 15 | @end 16 | 17 | 18 | @implementation HBTableViewSectionModelClass 19 | @synthesize viewHeaderClass,nibHeaderName,viewFooterClass,nibFooterName,sectionHeaderHeight,sectionFooterHeight,rowArray = _rowArray; 20 | 21 | - (NSMutableArray *)rowArray{ 22 | if (!_rowArray) { 23 | _rowArray =[NSMutableArray array]; 24 | }return _rowArray; 25 | } 26 | @end 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewSectionModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewSectionViewProtocol.h 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/15. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** 15 | 所有表格类型的模型的协议 16 | */ 17 | @protocol HBTableViewCellModelProtocol 18 | /** cell重用标示 */ 19 | @property (nonatomic, copy) NSString *cellReusable; 20 | /** cell的高度 */ 21 | @property (nonatomic, assign) CGFloat rowHeight; 22 | /** isNib */ 23 | @property (nonatomic) BOOL isNib; 24 | @end 25 | /** 分区 */ 26 | @protocol HBTableViewSectionModelProtocol 27 | /** 区头 viewHeaderClass */ 28 | @property (nonatomic, copy) NSString *viewHeaderClass; 29 | /** 区头 nibHeaderName */ 30 | @property (nonatomic, copy) NSString *nibHeaderName; 31 | /** 区尾 viewClass */ 32 | @property (nonatomic, copy) NSString *viewFooterClass; 33 | /** 区尾 nibFooterName */ 34 | @property (nonatomic, copy) NSString *nibFooterName; 35 | /** 区头部的高度 sectionHeaderHeight*/ 36 | @property (nonatomic, assign) CGFloat sectionHeaderHeight; 37 | /** 区尾部的高度 sectionFooterHeight*/ 38 | @property (nonatomic, assign) CGFloat sectionFooterHeight; 39 | /** 分区区对应的 rowArray*/ 40 | @property (nonatomic, strong) NSMutableArray >*rowArray; 41 | @end 42 | 43 | 44 | NS_ASSUME_NONNULL_END 45 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewSectionViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableDataModel.h 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "HBTableViewSectionViewModelProtocol.h" 12 | 13 | @interface HBTableViewCellViewModel: NSObject 14 | 15 | @end 16 | 17 | #pragma mark - mark HBTableViewSectionViewModel 18 | 19 | @interface HBTableViewSectionViewModel: NSObject 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewSectionViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableDataModel.m 3 | // example 4 | // 5 | // Created by hbzq on 2018/12/25. 6 | // Copyright © 2018 hulailin. All rights reserved. 7 | // 8 | 9 | #import "HBTableViewSectionViewModel.h" 10 | 11 | 12 | @implementation HBTableViewCellViewModel 13 | @synthesize className,configRowHeight,isNib,configCellData,didSelectRowAtIndexPath,rowData; 14 | 15 | @end 16 | 17 | 18 | @implementation HBTableViewSectionViewModel 19 | @synthesize configSectionHeaderHeight,configSectionHeaderView,sectionHeaderData,configSectionHeaderData,configSectionFooterHeight,configFooterView,sectionFooterData,configSectionFooterData,rowDataArray=_rowDataArray; 20 | 21 | - (NSMutableArray *)rowDataArray{ 22 | if (!_rowDataArray) { 23 | _rowDataArray =[NSMutableArray array]; 24 | }return _rowDataArray; 25 | } 26 | @end 27 | 28 | -------------------------------------------------------------------------------- /HBTableViewFrameWork/Classes/HBTableViewSectionViewModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HBTableViewSectionViewModelProtocol.h 3 | // HBTableViewFrameWork_Example 4 | // 5 | // Created by hbzq on 2019/1/16. 6 | // Copyright © 2019 hulailin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HBTableViewSectionModelProtocol.h" 11 | #import "HBTableViewBaseViewProtocol.h" 12 | typedef NSString *(^configCellIdentifier)(UITableView *tableView,NSIndexPath *indexPath); 13 | typedef CGFloat (^configRowHeight)(NSIndexPath *indexPath); 14 | typedef void(^configCellData)(idcell,idcellModel); 15 | typedef void(^didSelectRowAtIndexPath)(UITableView *tableView,NSIndexPath *indexPath,id rowData); 16 | @protocol HBTableViewCellModelViewProtocol 17 | 18 | /** 当前cell的Class,要保证当前aClass名称与当前identifier标识符一致 */ 19 | @property (nonatomic ,copy) NSString* className; 20 | /** cell的高度 用block是为了能动态计算cell的高度*/ 21 | @property (nonatomic, copy) configRowHeight configRowHeight; 22 | /** cell的Data赋值*/ 23 | @property (nonatomic, copy) configCellData configCellData; 24 | /** 点击响应 */ 25 | @property (nonatomic, copy) didSelectRowAtIndexPath didSelectRowAtIndexPath; 26 | /** 是否通过nib加载cell,默认为NO isNib */ 27 | @property (nonatomic) BOOL isNib; 28 | /** cell填充数据 */ 29 | @property (nonatomic, strong) id rowData; 30 | 31 | @end 32 | 33 | @protocol HBTableSectionModelViewProtocol 34 | typedef CGFloat(^configSectionHeaderHeight)(NSInteger section); 35 | typedef id (^configSectionHeaderView)(UITableView *tableView,NSInteger section); 36 | typedef CGFloat(^configSectionFooterHeight)(NSInteger section); 37 | typedef id (^configSectionFooterView)(UITableView *tableView,NSInteger section); 38 | 39 | 40 | 41 | #pragma mark - 分区视图2个属性必须配置,否则不显示 42 | /** 分区头视图高度 configSectionHeaderHeight*/ 43 | @property (nonatomic, copy) configSectionHeaderHeight configSectionHeaderHeight; 44 | /** 分区头视图 configSectionHeaderView*/ 45 | @property (nonatomic, strong) configSectionHeaderView configSectionHeaderView; 46 | 47 | #pragma mark - 分区视图2个属性必须配置,否则不显示 48 | /** 分区尾视图高度 configSectionFooterHeight*/ 49 | @property (nonatomic, copy) configSectionFooterHeight configSectionFooterHeight; 50 | /** 分区尾视图 configFooterView*/ 51 | @property (nonatomic, strong) configSectionFooterView configFooterView; 52 | /** 分区头部头部视图数据 sectionHeaderData*/ 53 | @property (nonatomic, strong) id< HBTableViewSectionModelProtocol> sectionHeaderData; 54 | /** 分区尾部视图数据 sectionFooterData*/ 55 | @property (nonatomic, strong) id< HBTableViewSectionModelProtocol> sectionFooterData; 56 | /** 更新头视图数据 sectionFooterData*/ 57 | @property (nonatomic, strong) void(^configSectionHeaderData)(UITableView *tableView,NSInteger section,idview, id< HBTableViewSectionModelProtocol>sectionData); 58 | /** 更新尾视图数据 sectionFooterData*/ 59 | @property (nonatomic, strong) void(^configSectionFooterData)(UITableView *tableView,NSInteger section,idview, id< HBTableViewSectionModelProtocol>footerData); 60 | /** 分区内的数据模型 rowDataArray*/ 61 | @property (nonatomic, strong) NSMutableArray >*rowDataArray; 62 | @end 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 hulailin 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HBTableViewFrameWork 2 | 3 | [![CI Status](https://img.shields.io/travis/hulailin/HBTableViewFrameWork.svg?style=flat)](https://travis-ci.org/hulailin/HBTableViewFrameWork) 4 | [![Version](https://img.shields.io/cocoapods/v/HBTableViewFrameWork.svg?style=flat)](https://cocoapods.org/pods/HBTableViewFrameWork) 5 | [![License](https://img.shields.io/cocoapods/l/HBTableViewFrameWork.svg?style=flat)](https://cocoapods.org/pods/HBTableViewFrameWork) 6 | [![Platform](https://img.shields.io/cocoapods/p/HBTableViewFrameWork.svg?style=flat)](https://cocoapods.org/pods/HBTableViewFrameWork) 7 | 8 | ## Example 9 | 10 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 11 | 12 | ## Requirements 13 | 14 | ## Installation 15 | 16 | HBTableViewFrameWork is available through [CocoaPods](https://cocoapods.org). To install 17 | it, simply add the following line to your Podfile: 18 | 19 | ```ruby 20 | pod 'HBTableViewFrameWork', '~> 0.1.3' 21 | ``` 22 | # HBTableViewFrameWork 23 | 快速搭建tableView 24 | 25 | 导入 26 | 数据模型继承HBTableViewCellModelClass 27 | 实现关键3个方法 28 | - (NSString *)cellReusable{ 29 | return @"HBShortElvesTableViewCell"; 30 | } 31 | 32 | - (CGFloat)rowHeight{ 33 | return 54.0; 34 | } 35 | 36 | - (BOOL)isNib { 37 | return YES; 38 | } 39 | 40 | 41 | viewcontroller中初始化 42 | > 43 | - (HBTableViewListFrame *)tableViewList{ 44 | if (!_tableViewList) { 45 | _tableViewList = [HBTableViewListFrame tableViewListFrame:self.tableView] ; 46 | } 47 | return _tableViewList; 48 | } 49 | 50 | [self.tableViewList updateListWithModels:self.dataArray dataConfigBlock:^(id _Nonnull cell, id _Nonnull model) { 51 | //如果是集成于基类的cell 默认不需要实现 52 | } didSelectRowAtIndexPath:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath, id _Nonnull rowData) { 53 | __strong __typeof(weakSelf)strongSelf = weakSelf; 54 | //cell点击响应 55 | 56 | }]; 57 | 58 | tableView的代理协议都不需要写了 59 | 60 | ## Author 61 | 62 | hulailin, 376999818@qq.com 63 | 64 | ## License 65 | 66 | HBTableViewFrameWork is available under the MIT license. See the LICENSE file for more info. 67 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------