├── Example ├── Tests │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Tests-Prefix.pch │ ├── Tests-Info.plist │ └── Tests.m ├── CD_ObjC │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── CDViewController.h │ ├── Cell_Title.h │ ├── CDAppDelegate.h │ ├── main.m │ ├── CD_ObjC-Prefix.pch │ ├── Cell_Title.m │ ├── CDViewController.m │ ├── CD_ObjC-Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ └── CDAppDelegate.m ├── CD_ObjC.xcworkspace │ ├── xcuserdata │ │ └── lcd.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ ├── IDEFindNavigatorScopes.plist │ │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── CD_ObjC.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── CD_ObjC-Example.xcscheme │ └── project.pbxproj ├── Module │ └── Home │ │ ├── Home │ │ ├── Classes │ │ │ ├── Views │ │ │ │ ├── Cell_CollectionView.m │ │ │ │ ├── Cell_CollectionViewClass.m │ │ │ │ ├── View_CollectionReusableView.m │ │ │ │ ├── View_CollectionReusableViewClass.m │ │ │ │ ├── Cell_TableView.h │ │ │ │ ├── Cell_TableViewXib.h │ │ │ │ ├── Cell_TableViewClass.h │ │ │ │ ├── Cell_CollectionView.h │ │ │ │ ├── Cell_CollectionViewXib.h │ │ │ │ ├── Cell_CollectionViewClass.h │ │ │ │ ├── View_TableViewHeaderXib.h │ │ │ │ ├── View_CollectionReusableView.h │ │ │ │ ├── View_TableViewHeaderClass.h │ │ │ │ ├── View_CollectionReusableViewXib.h │ │ │ │ ├── View_CollectionReusableViewClass.h │ │ │ │ ├── Cell_CollectionViewXib.m │ │ │ │ ├── View_CollectionReusableViewXib.m │ │ │ │ ├── View_TableViewHeaderXib.m │ │ │ │ ├── View_TableViewHeaderClass.m │ │ │ │ ├── Cell_TableView.m │ │ │ │ ├── Cell_TableViewClass.m │ │ │ │ └── Cell_TableViewXib.m │ │ │ ├── Collection │ │ │ │ ├── VM_CollectionViewForm.m │ │ │ │ ├── VC_CollectionViewForm.h │ │ │ │ ├── VM_CollectionViewForm.h │ │ │ │ └── VC_CollectionViewForm.m │ │ │ ├── R_Home.h │ │ │ ├── Table │ │ │ │ ├── VC_TableViewForm.h │ │ │ │ ├── VM_TableViewForm.h │ │ │ │ ├── VC_TableViewForm.m │ │ │ │ └── VM_TableViewForm.m │ │ │ └── R_Home.m │ │ └── Nib │ │ │ ├── View_CollectionReusableViewXib.xib │ │ │ ├── View_TableViewHeaderXib.xib │ │ │ ├── Cell_CollectionViewXib.xib │ │ │ ├── Cell_TableViewXib.xib │ │ │ └── HomeStoryboard.storyboard │ │ └── Home.podspec └── Podfile ├── CaamDauObjC ├── Categories │ ├── NSString+CD.h │ ├── NSString+CD.m │ ├── NSBundle+CD.h │ ├── UITableView+CD.h │ ├── UICollectionView+CD.h │ ├── UIViewController+CD.h │ ├── NSBundle+CD.m │ ├── UICollectionView+CD.m │ ├── UITableView+CD.m │ └── UIViewController+CD.m ├── Chain │ ├── NSLayoutConstraint+Chain.h │ ├── NSLayoutConstraint+Chain.m │ ├── UIImageView+Chain.h │ ├── UILabel+Chain.h │ ├── UIButton+Chain.h │ ├── UIAlertController+Chain.h │ ├── UIImageView+Chain.m │ ├── UIView+Chain.h │ ├── UILabel+Chain.m │ ├── UIView+Chain.m │ ├── UIButton+Chain.m │ └── UIAlertController+Chain.m ├── MJRefresh │ ├── CDMJRefresh.h │ ├── CD_MJRefreshModel.h │ ├── UIScrollView+CD_MJRefresh.h │ ├── CD_MJRefreshModel.m │ └── UIScrollView+CD_MJRefresh.m ├── CaamDauObjC.h └── Form │ ├── README.md │ ├── CD_Form.h │ ├── CD_Row.h │ ├── CD_Row.m │ └── CD_Form.m ├── .travis.yml ├── LICENSE ├── CaamDauObjC.podspec └── README.md /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/CD_ObjC/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/NSString+CD.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface NSString (CD) 6 | 7 | 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/NSString+CD.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "NSBundle+CD.h" 4 | 5 | 6 | 7 | @implementation NSString (CD) 8 | 9 | 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/NSLayoutConstraint+Chain.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface NSLayoutConstraint (Chain) 6 | - (NSLayoutConstraint * (NS_NOESCAPE ^)(CGFloat ))cd_constant; 7 | @end 8 | -------------------------------------------------------------------------------- /CaamDauObjC/MJRefresh/CDMJRefresh.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CDMJRefresh_h 3 | #define CDMJRefresh_h 4 | 5 | #import "CD_MJRefreshModel.h" 6 | #import "UIScrollView+CD_MJRefresh.h" 7 | 8 | 9 | #endif /* CDMJRefresh_h */ 10 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcworkspace/xcuserdata/lcd.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CaamDau/CaamDauObjC/HEAD/Example/CD_ObjC.xcworkspace/xcuserdata/lcd.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /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 | @import Kiwi; 6 | @import FBSnapshotTestCase; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcworkspace/xcuserdata/lcd.xcuserdatad/IDEFindNavigatorScopes.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_CollectionView.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "Cell_CollectionView.h" 11 | 12 | @implementation Cell_CollectionView 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Collection/VM_CollectionViewForm.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "VM_CollectionViewForm.h" 11 | 12 | @implementation VM_CollectionViewForm 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_CollectionViewClass.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "Cell_CollectionViewClass.h" 11 | 12 | @implementation Cell_CollectionViewClass 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/CD_ObjC/CDViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDViewController.h 3 | // CD_ObjC 4 | // 5 | // Created by liucaide on 12/15/2018. 6 | // Copyright (c) 2018 liucaide. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface CDViewController : UIViewController 12 | 13 | @end 14 | 15 | 16 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_CollectionReusableView.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "View_CollectionReusableView.h" 11 | 12 | @implementation View_CollectionReusableView 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/NSBundle+CD.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface NSBundle (CD) 6 | 7 | + (instancetype _Nullable )cd_bundleWithClass:(Class _Nonnull )cls forResource:(nullable NSString*)name; 8 | 9 | + (instancetype _Nullable )cd_bundleWithClass:(Class _Nonnull )cls; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/NSLayoutConstraint+Chain.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "NSLayoutConstraint+Chain.h" 4 | 5 | @implementation NSLayoutConstraint (Chain) 6 | - (NSLayoutConstraint * (^)(CGFloat ))cd_constant{ 7 | return ^(CGFloat a){ 8 | self.constant = a; 9 | return self; 10 | }; 11 | } 12 | @end 13 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/CD_ObjC/Cell_Title.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/6 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface Cell_Title : UITableViewCell 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_CollectionReusableViewClass.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "View_CollectionReusableViewClass.h" 11 | 12 | @implementation View_CollectionReusableViewClass 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/UITableView+CD.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | NS_ASSUME_NONNULL_BEGIN 5 | @interface UITableView (CD) 6 | - (UITableViewCell *)cd_cell:(Class)cell bundleFrom:(NSString*)from; 7 | - (UITableViewHeaderFooterView *)cd_view:(Class)view bundleFrom:(NSString*)from; 8 | @end 9 | NS_ASSUME_NONNULL_END 10 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | platform :ios, '9.0' 4 | 5 | target 'CD_ObjC_Example' do 6 | pod 'CaamDauObjC/All', :path => '../' 7 | 8 | pod 'Home', :path => './Module/Home' 9 | 10 | target 'CD_ObjC_Tests' do 11 | inherit! :search_paths 12 | 13 | pod 'Kiwi' 14 | #pod 'FBSnapshotTestCase' 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/R_Home.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface R_Home : NSObject 15 | + (void)tableViewForm; 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_TableView.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface Cell_TableView : UITableViewCell 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Table/VC_TableViewForm.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface VC_TableViewForm : UIViewController 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_TableViewXib.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface Cell_TableViewXib : UITableViewCell 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_TableViewClass.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface Cell_TableViewClass : UITableViewCell 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/CD_ObjC/CDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDAppDelegate.h 3 | // CD_ObjC 4 | // 5 | // Created by liucaide on 12/15/2018. 6 | // Copyright (c) 2018 liucaide. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface CDAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_CollectionView.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface Cell_CollectionView : UICollectionViewCell 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Collection/VC_CollectionViewForm.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface VC_CollectionViewForm : UIViewController 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Collection/VM_CollectionViewForm.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface VM_CollectionViewForm : CD_Form 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_CollectionViewXib.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface Cell_CollectionViewXib : UICollectionViewCell 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_CollectionViewClass.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface Cell_CollectionViewClass : UICollectionViewCell 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_TableViewHeaderXib.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface View_TableViewHeaderXib : UITableViewHeaderFooterView 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_CollectionReusableView.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface View_CollectionReusableView : UICollectionReusableView 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_TableViewHeaderClass.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface View_TableViewHeaderClass : UITableViewHeaderFooterView 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Table/VM_TableViewForm.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface VM_TableViewForm : CD_Form 15 | - (void)requestData:(BOOL)refresh; 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_CollectionReusableViewXib.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface View_CollectionReusableViewXib : UICollectionReusableView 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_CollectionReusableViewClass.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface View_CollectionReusableViewClass : UICollectionReusableView 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_CollectionViewXib.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "Cell_CollectionViewXib.h" 11 | 12 | @implementation Cell_CollectionViewXib 13 | 14 | - (void)awakeFromNib { 15 | [super awakeFromNib]; 16 | // Initialization code 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CaamDauObjC/CaamDauObjC.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Form_h 3 | #define Form_h 4 | 5 | #import "CD_Row.h" 6 | #import "CD_Form.h" 7 | 8 | #import "UIView+Chain.h" 9 | #import "UIButton+Chain.h" 10 | #import "UILabel+Chain.h" 11 | #import "UIImageView+Chain.h" 12 | #import "UIAlertController+Chain.h" 13 | 14 | #import "UITableView+CD.h" 15 | #import "NSBundle+CD.h" 16 | #import "UIViewController+CD.h" 17 | #endif /* Form_h */ 18 | -------------------------------------------------------------------------------- /Example/CD_ObjC/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CD_ObjC 4 | // 5 | // Created by liucaide on 12/15/2018. 6 | // Copyright (c) 2018 liucaide. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "CDAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CDAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_CollectionReusableViewXib.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "View_CollectionReusableViewXib.h" 11 | 12 | @implementation View_CollectionReusableViewXib 13 | 14 | - (void)awakeFromNib { 15 | [super awakeFromNib]; 16 | // Initialization code 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/CD_ObjC/CD_ObjC-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 | #import 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 | 18 | 19 | -------------------------------------------------------------------------------- /Example/CD_ObjC/Cell_Title.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/6 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "Cell_Title.h" 11 | @interface Cell_Title() 12 | @end 13 | 14 | @implementation Cell_Title 15 | 16 | - (void)awakeFromNib { 17 | [super awakeFromNib]; 18 | 19 | } 20 | 21 | 22 | 23 | - (void)row_updateViewData:(id)data { 24 | NSString * text = data; 25 | self.textLabel.text = text; 26 | } 27 | @end 28 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/UICollectionView+CD.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | NS_ASSUME_NONNULL_BEGIN 5 | @interface UICollectionView (CD) 6 | - (UICollectionViewCell *)cd_cell:(Class)cell indexPath:(NSIndexPath*)index; 7 | - (UICollectionReusableView *)cd_view:(Class)cell indexPath:(NSIndexPath*)index kind:(NSString*)kind; 8 | - (void)cd_registerClass:(Class)cell bundleFrom:(NSString*)from; 9 | - (void)cd_registerView:(Class)view bundleFrom:(NSString*)from kind:(NSString*)kind; 10 | @end 11 | NS_ASSUME_NONNULL_END 12 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_TableViewHeaderXib.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "View_TableViewHeaderXib.h" 11 | 12 | @implementation View_TableViewHeaderXib 13 | 14 | /* 15 | // Only override drawRect: if you perform custom drawing. 16 | // An empty implementation adversely affects performance during animation. 17 | - (void)drawRect:(CGRect)rect { 18 | // Drawing code 19 | } 20 | */ 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/View_TableViewHeaderClass.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "View_TableViewHeaderClass.h" 11 | 12 | @implementation View_TableViewHeaderClass 13 | 14 | /* 15 | // Only override drawRect: if you perform custom drawing. 16 | // An empty implementation adversely affects performance during animation. 17 | - (void)drawRect:(CGRect)rect { 18 | // Drawing code 19 | } 20 | */ 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/R_Home.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "R_Home.h" 11 | #import "VC_TableViewForm.h" 12 | #import 13 | @implementation R_Home 14 | + (void)tableViewForm{ 15 | UIViewController *vc = [VC_TableViewForm cd_storyboard:@"HomeStoryboard" bundleForm:@"Home"]; 16 | UIViewController *svc = CD_VC; 17 | [[svc navigationController] pushViewController:vc animated:YES]; 18 | } 19 | @end 20 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/UIViewController+CD.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+CD.h 3 | // CDKit_OCDemo 4 | // 5 | // Created by LCD on 2017/11/17. 6 | // Copyright © 2017年 LCD. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define CD_VC [UIViewController cd_getViewController] 12 | 13 | @interface UIViewController (CD) 14 | + (instancetype)cd_init; 15 | + (instancetype)cd_storyboard; 16 | + (instancetype)cd_storyboard:(NSString*)name; 17 | + (instancetype)cd_storyboard:(NSString*)name bundleForm:(NSString*)form; 18 | 19 | + (UIViewController *)cd_getViewController; 20 | @end 21 | -------------------------------------------------------------------------------- /.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/CD_ObjC.xcworkspace -scheme CD_ObjC-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /CaamDauObjC/Form/README.md: -------------------------------------------------------------------------------- 1 | # CD_Form ([Swift版本在这里](https://github.com/liucaide/CD/tree/master/CD/CD_Form)) 2 | 3 | ## Installation 4 | 5 | CD is available through [CocoaPods](https://cocoapods.org). To install 6 | it, simply add the following line to your Podfile: 7 | 8 | ```ruby 9 | pod 'CaamDauObjC' 10 | ``` 11 | ### 原理: 12 | 我们将 Cell 排版 转化为 一个 CD_Row 单元模型 13 | ### 无论界面多复杂,都是一样的代码,使用这种方式即可轻松完成复杂的 UI 排版,适用所有 UIView,编写可读性、扩展性、维护性强的代码 14 | 15 | ## Author 16 | 17 | liucaide, 565726319@qq.com 18 | 19 | ## License 20 | 21 | CD is available under the MIT license. See the LICENSE file for more info. 22 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/NSBundle+CD.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "NSBundle+CD.h" 4 | 5 | 6 | 7 | @implementation NSBundle (CD) 8 | 9 | + (instancetype _Nullable )cd_bundleWithClass:(Class _Nonnull )cls forResource:(nullable NSString*)name{ 10 | NSBundle *bundle = [NSBundle bundleForClass:cls]; 11 | NSURL *url = [bundle URLForResource:name withExtension:@"bundle"]; 12 | if (url) { 13 | return [NSBundle bundleWithURL:url]; 14 | } 15 | return NULL; 16 | } 17 | 18 | + (instancetype _Nullable )cd_bundleWithClass:(Class _Nonnull )cls{ 19 | return [NSBundle cd_bundleWithClass:cls forResource:NULL]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_TableView.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "Cell_TableView.h" 11 | @import CaamDauObjC; 12 | 13 | @interface Cell_TableView() 14 | @end 15 | @implementation Cell_TableView 16 | 17 | - (void)awakeFromNib { 18 | [super awakeFromNib]; 19 | } 20 | 21 | - (void)row_updateViewData:(id)data { 22 | NSString * text = data; 23 | self.textLabel.text = text; 24 | } 25 | - (void)row_updateConfig:(id)config { 26 | UIColor *color = config; 27 | self.textLabel.textColor = color; 28 | } 29 | @end 30 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcworkspace/xcuserdata/lcd.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /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/Module/Home/Home/Classes/Collection/VC_CollectionViewForm.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "VC_CollectionViewForm.h" 11 | 12 | @interface VC_CollectionViewForm () 13 | 14 | @end 15 | 16 | @implementation VC_CollectionViewForm 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view. 21 | } 22 | 23 | /* 24 | #pragma mark - Navigation 25 | 26 | // In a storyboard-based application, you will often want to do a little preparation before navigation 27 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 28 | // Get the new view controller using [segue destinationViewController]. 29 | // Pass the selected object to the new view controller. 30 | } 31 | */ 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIImageView+Chain.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface UIImageView (Chain) 6 | - (UIImageView * (NS_NOESCAPE ^)(UIImage *))cd_image; 7 | 8 | - (UIImageView * (NS_NOESCAPE ^)(UIImage *))cd_highlightedImage; 9 | - (UIImageView * (NS_NOESCAPE ^)(BOOL))cd_highlighted; 10 | 11 | - (UIImageView * (NS_NOESCAPE ^)(NSArray *))cd_animationImages; 12 | - (UIImageView * (NS_NOESCAPE ^)(NSArray *))cd_highlightedAnimationImages; 13 | 14 | - (UIImageView * (NS_NOESCAPE ^)(NSTimeInterval))cd_animationDuration; 15 | 16 | - (UIImageView * (NS_NOESCAPE ^)(NSInteger))cd_animationRepeatCount; 17 | - (UIImageView * (NS_NOESCAPE ^)(void))cd_startAnimating; 18 | - (UIImageView * (NS_NOESCAPE ^)(void))cd_stopAnimating; 19 | - (UIImageView * (NS_NOESCAPE ^)(NSArray *names, NSTimeInterval t))cd_animateImageNames; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_TableViewClass.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "Cell_TableViewClass.h" 11 | @import CaamDauObjC; 12 | @interface Cell_TableViewClass() 13 | @end 14 | @implementation Cell_TableViewClass 15 | 16 | - (void)awakeFromNib { 17 | [super awakeFromNib]; 18 | // Initialization code 19 | } 20 | 21 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 22 | [super setSelected:selected animated:animated]; 23 | 24 | // Configure the view for the selected state 25 | } 26 | - (void)row_updateViewData:(id)data { 27 | NSString * text = data; 28 | self.textLabel.text = text; 29 | } 30 | - (void)row_updateConfig:(id)config { 31 | UIColor *color = config; 32 | self.textLabel.textColor = color; 33 | } 34 | @end 35 | -------------------------------------------------------------------------------- /Example/Module/Home/Home.podspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pod::Spec.new do |s| 4 | s.name = 'Home' 5 | s.version = '0.1.0' 6 | s.summary = 'A short description of .' 7 | 8 | 9 | 10 | s.description = <<-DESC 11 | TODO: Add long description of the pod here. 12 | DESC 13 | 14 | s.homepage = 'https://github.com/liucaide' 15 | 16 | #s.license = { :type => 'MIT', :file => 'LICENSE' } 17 | s.author = { 'liucaide' => '565726319@qq.com' } 18 | s.source = { :git => '' } 19 | 20 | 21 | s.ios.deployment_target = '9.0' 22 | 23 | s.source_files = 'Home/Classes/**/*' 24 | s.public_header_files = 'Home/Classes/R_Home.h' 25 | s.resource_bundles = { 26 | 'Home' => ['Home/Nib/*.{xib,storyboard}'] 27 | } 28 | 29 | # s.public_header_files = 'Pod/Classes/**/*.h' 30 | # s.frameworks = 'UIKit', 'MapKit' 31 | s.dependency 'CaamDauObjC' 32 | end 33 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CD_ObjCTests.m 3 | // CD_ObjCTests 4 | // 5 | // Created by liucaide on 12/15/2018. 6 | // Copyright (c) 2018 liucaide. All rights reserved. 7 | // 8 | 9 | // https://github.com/kiwi-bdd/Kiwi 10 | 11 | SPEC_BEGIN(InitialTests) 12 | 13 | describe(@"My initial tests", ^{ 14 | 15 | context(@"will fail", ^{ 16 | 17 | it(@"can do maths", ^{ 18 | [[@1 should] equal:@2]; 19 | }); 20 | 21 | it(@"can read", ^{ 22 | [[@"number" should] equal:@"string"]; 23 | }); 24 | 25 | it(@"will wait and fail", ^{ 26 | NSObject *object = [[NSObject alloc] init]; 27 | [[expectFutureValue(object) shouldEventually] receive:@selector(autoContentAccessingProxy)]; 28 | }); 29 | }); 30 | 31 | context(@"will pass", ^{ 32 | 33 | it(@"can do maths", ^{ 34 | [[@1 should] beLessThan:@23]; 35 | }); 36 | 37 | it(@"can read", ^{ 38 | [[@"team" shouldNot] containString:@"I"]; 39 | }); 40 | }); 41 | 42 | }); 43 | 44 | SPEC_END 45 | 46 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UILabel+Chain.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface UILabel (Chain) 6 | - (UILabel * (NS_NOESCAPE ^)(NSString *))cd_text; 7 | - (UILabel * (NS_NOESCAPE ^)(UIColor *))cd_textColor; 8 | - (UILabel * (NS_NOESCAPE ^)(UIFont *))cd_font; 9 | - (UILabel * (NS_NOESCAPE ^)(NSTextAlignment))cd_alignment; 10 | - (UILabel * (NS_NOESCAPE ^)(NSInteger))cd_numberOfLines; 11 | - (UILabel * (NS_NOESCAPE ^)(NSAttributedString *))cd_attributedText; 12 | /// 行间距、会将lab.text 转化为 lab.attributedText 13 | - (UILabel * (NS_NOESCAPE ^)(CGFloat))cd_lineSpacing; 14 | - (UILabel * (NS_NOESCAPE ^)(NSLineBreakMode))cd_lineBreakMode; 15 | - (UILabel * (NS_NOESCAPE ^)(UIBaselineAdjustment))cd_baselineAdjustment; 16 | 17 | - (UILabel * (NS_NOESCAPE ^)(BOOL))cd_allowsDefaultTighteningForTruncation; 18 | 19 | - (UILabel * (NS_NOESCAPE ^)(CGFloat))cd_preferredMaxLayoutWidth; 20 | 21 | - (UILabel * (NS_NOESCAPE ^)(BOOL))cd_adjustsFontSizeToFitWidth; 22 | 23 | - (UILabel * (NS_NOESCAPE ^)(UIColor *))cd_highlightedTextColor; 24 | 25 | - (UILabel * (NS_NOESCAPE ^)(CGFloat))cd_minimumScaleFactor; 26 | @end 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 水果刀削面 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Views/Cell_TableViewXib.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "Cell_TableViewXib.h" 11 | @import CaamDauObjC; 12 | 13 | @interface Cell_TableViewXib() 14 | @property (nonatomic, copy) CD_RowCallback callback; 15 | @end 16 | @implementation Cell_TableViewXib 17 | 18 | - (void)awakeFromNib { 19 | [super awakeFromNib]; 20 | // Initialization code 21 | } 22 | 23 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | - (IBAction)buttonClick:(UIButton *)sender { 29 | if (self.callback) { 30 | self.callback(@"Cell_TableViewXib"); 31 | } 32 | } 33 | 34 | - (void)row_callback:(CD_RowCallback)block { 35 | self.callback = block; 36 | } 37 | - (void)row_updateConfig:(id)config { 38 | UIColor *color = config; 39 | self.textLabel.textColor = color; 40 | } 41 | - (void)row_updateViewData:(id)data { 42 | NSString * text = data; 43 | self.textLabel.text = text; 44 | } 45 | @end 46 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Nib/View_CollectionReusableViewXib.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Nib/View_TableViewHeaderXib.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Classes/Table/VC_TableViewForm.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "VC_TableViewForm.h" 11 | #import "VM_TableViewForm.h" 12 | @import CaamDauObjC; 13 | 14 | @interface VC_TableViewForm () 15 | @property (nonatomic, strong) VM_TableViewForm *vm; 16 | @property (nonatomic, strong) CD_FormTableViewDelegateDataSource *delegateData; 17 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 18 | 19 | @end 20 | 21 | @implementation VC_TableViewForm 22 | 23 | - (VM_TableViewForm *)vm { 24 | if (!_vm) { 25 | _vm = [VM_TableViewForm new]; 26 | } 27 | return _vm; 28 | } 29 | 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | 33 | self.delegateData = [[CD_FormTableViewDelegateDataSource alloc] initWithForm:self.vm]; 34 | self.tableView.delegate = self.delegateData; 35 | self.tableView.dataSource = self.delegateData; 36 | 37 | [self.delegateData makeTableView:self.tableView]; 38 | 39 | __weak typeof(self) weakSelf = self; 40 | [self.tableView cd_headerAddMJRefresh:^{ 41 | __strong typeof(weakSelf) strongSelf = weakSelf; 42 | [strongSelf.vm requestData:YES]; 43 | [strongSelf.tableView cd_endRefreshing]; 44 | }]; 45 | [self.tableView cd_beginRefreshing]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /CaamDauObjC/Form/CD_Form.h: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/3 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import 11 | #import "CD_Row.h" 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | 15 | @interface CD_Form : NSObject 16 | @property (nonatomic, strong) NSMutableArray*>* forms; 17 | @property (nonatomic, strong) NSMutableArray* headers; 18 | @property (nonatomic, strong) NSMutableArray* footers; 19 | 20 | @property (nonatomic, copy) void (^reloadData)(void); 21 | @property (nonatomic, copy) void (^reloadRows)(NSArray* rows, UITableViewRowAnimation animation); 22 | @property (nonatomic, copy) void (^reloadSections)(NSIndexSet* sections, UITableViewRowAnimation animation); 23 | 24 | 25 | @end 26 | 27 | 28 | 29 | 30 | @interface CD_FormDelegateDataSource : NSObject 31 | @property (nonatomic, strong, readonly) CD_Form* form; 32 | 33 | - (instancetype)initWithForm:(CD_Form*)form; 34 | @end 35 | 36 | 37 | @interface CD_FormTableViewDelegateDataSource : CD_FormDelegateDataSource 38 | 39 | - (void)makeTableView:(__weak UITableView*)tableView; 40 | 41 | @end 42 | 43 | 44 | @interface CD_FormCollectionViewDelegateDataSource : CD_FormDelegateDataSource 45 | - (void)makeCollectionView:(__weak UICollectionView*)collectionView; 46 | @end 47 | 48 | 49 | @interface CD_CollectionReusableViewNone : UICollectionReusableView 50 | 51 | + (NSString*)bundle; 52 | @end 53 | NS_ASSUME_NONNULL_END 54 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Nib/Cell_CollectionViewXib.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CaamDauObjC.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = 'CaamDauObjC' 4 | s.version = '1.0' 5 | s.summary = 'A iOS development toolbox of Object-C (OC版iOS开发工具箱).' 6 | 7 | s.description = <<-DESC 8 | TODO: Add long description of the pod here. 9 | DESC 10 | 11 | s.homepage = 'https://github.com/liucaide/CaamDauObjC' 12 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 13 | s.license = { :type => 'MIT', :file => 'LICENSE' } 14 | s.author = { 'liucaide' => '565726319@qq.com' } 15 | s.source = { :git => 'https://github.com/liucaide/CaamDauObjC.git' } 16 | # s.social_media_url = 'https://twitter.com/' 17 | 18 | s.ios.deployment_target = '9.0' 19 | 20 | s.default_subspec = 'Core' 21 | 22 | s.subspec 'Core' do |core| 23 | # core.public_header_files = 'CaamDauObjC/CaamDauObjC.h' 24 | core.source_files = 'CaamDauObjC/CaamDauObjC.h', 'CaamDauObjC/Chain/*.{h,m}', 'CaamDauObjC/Categories/*.{h,m}', 'CaamDauObjC/Form/*.{h,m}' 25 | 26 | end 27 | 28 | s.subspec 'All' do |all| 29 | all.dependency 'CaamDauObjC/Core' 30 | all.dependency 'CaamDauObjC/MJRefresh' 31 | 32 | end 33 | 34 | # ---- 第三方 扩展 或 桥接 35 | s.subspec 'MJRefresh' do |mj| 36 | mj.source_files = 'CaamDauObjC/MJRefresh/*.{h,m}' 37 | # mj.public_header_files = 'CaamDauObjC/MJRefresh/CDMJRefresh.h' 38 | mj.dependency 'MJRefresh' 39 | end 40 | 41 | # s.resource_bundles = { 42 | # 'CaamDauObjC' => ['CaamDauObjC/Assets/*.png'] 43 | # } 44 | # s.public_header_files = 'Pod/Classes/**/*.h' 45 | s.frameworks = 'UIKit', 'Foundation' 46 | end 47 | -------------------------------------------------------------------------------- /CaamDauObjC/Form/CD_Row.h: -------------------------------------------------------------------------------- 1 | // 附上Swift 版本:https://github.com/liucaide/CD 2 | 3 | 4 | #import 5 | #import 6 | 7 | NS_ASSUME_NONNULL_BEGIN 8 | 9 | typedef void (^CD_RowDidSelect)(void); 10 | typedef void (^CD_RowCallback)(id any); 11 | 12 | @protocol CD_RowDelegate 13 | @optional 14 | - (void)row_updateConfig:(id)config; 15 | - (void)row_updateViewData:(id)data; 16 | - (void)row_callback:(CD_RowCallback)block; 17 | @end 18 | 19 | 20 | @interface CD_Row : NSObject 21 | @property(nonatomic, copy, readonly) NSString *identifier; 22 | /// Row size 23 | @property(nonatomic, assign) CGRect frame; 24 | @property(nonatomic, assign) CGSize size; 25 | @property(nonatomic, assign) CGFloat height; 26 | /** 27 | 用于UICollectionView sectionInset, 28 | 另 LineSpacing InteritemSpacing 使用 frame - x y 29 | 用于 UIButton imageEdgeInsets 30 | */ 31 | ///UIEdgeInsets 32 | @property(nonatomic, assign) UIEdgeInsets insets; 33 | /// UIEdgeInsets 可用于 UIButton titleEdgeInsets 34 | @property(nonatomic, assign) UIEdgeInsets insetsTitle; 35 | /// view Class 类 36 | @property(nonatomic, strong) Class viewClass; 37 | /// - 来源 38 | @property(nonatomic, copy) NSString *bundleFrom; 39 | /// 数据源 - 配置 40 | @property(nonatomic, strong) id config; 41 | /// 数据源 - 数据 42 | @property(nonatomic, strong) id viewData; 43 | 44 | /// view 内部事件回调 45 | @property(nonatomic, copy) CD_RowCallback callback; 46 | /// view 点击回调 47 | @property(nonatomic, copy) CD_RowDidSelect didSelect; 48 | /// 49 | 50 | 51 | - (instancetype)initWithViewClass:(Class)cls then:(void (^)(CD_Row *))then; 52 | + (instancetype)rowWithViewClass:(Class)cls then:(void (^)(CD_Row *))then; 53 | 54 | - (void)bindView:(UIView *)view; 55 | @end 56 | 57 | 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /Example/CD_ObjC/CDViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDViewController.m 3 | // CD_ObjC 4 | // 5 | // Created by liucaide on 12/15/2018. 6 | // Copyright (c) 2018 liucaide. All rights reserved. 7 | // 8 | 9 | #import "CDViewController.h" 10 | #import 11 | #import "Cell_Title.h" 12 | @interface CDViewController () 13 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 14 | @property (nonatomic, strong) CD_Form * datas; 15 | @property (nonatomic, strong) CD_FormTableViewDelegateDataSource *delegateData; 16 | @end 17 | 18 | @implementation CDViewController 19 | - (CD_Form *)datas { 20 | if (!_datas) { 21 | _datas = [CD_Form new]; 22 | } 23 | return _datas; 24 | } 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | 30 | self.delegateData = [[CD_FormTableViewDelegateDataSource alloc] initWithForm:self.datas]; 31 | self.tableView.delegate = self.delegateData; 32 | self.tableView.dataSource = self.delegateData; 33 | 34 | [self.delegateData makeTableView:self.tableView]; 35 | [self makeForm]; 36 | } 37 | 38 | - (void)didReceiveMemoryWarning 39 | { 40 | [super didReceiveMemoryWarning]; 41 | 42 | } 43 | 44 | 45 | 46 | 47 | - (void)makeForm { 48 | NSMutableArray * f = [NSMutableArray array]; 49 | { 50 | CD_Row *row = [CD_Row rowWithViewClass:[Cell_Title class] then:^(CD_Row * _Nonnull obj) { 51 | obj.viewData = @"Form"; 52 | obj.height = 45; 53 | obj.bundleFrom = @"Home"; 54 | }]; 55 | row.didSelect = ^{ 56 | [R_Home tableViewForm]; 57 | }; 58 | [f addObject:row]; 59 | } 60 | [self.datas.forms addObject:f]; 61 | self.datas.reloadData(); 62 | } 63 | @end 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Example/CD_ObjC/CD_ObjC-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/Module/Home/Home/Classes/Table/VM_TableViewForm.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/4 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "VM_TableViewForm.h" 11 | #import "Cell_TableView.h" 12 | #import "Cell_TableViewClass.h" 13 | #import "Cell_TableViewXib.h" 14 | 15 | 16 | 17 | @implementation VM_TableViewForm 18 | 19 | - (void)makeForm { 20 | NSMutableArray * f = [NSMutableArray array]; 21 | { 22 | CD_Row *row = [CD_Row rowWithViewClass:[Cell_TableView class] then:^(CD_Row * _Nonnull obj) { 23 | obj.viewData = @"Cell_TableView"; 24 | obj.config = [UIColor redColor]; 25 | obj.height = 80; 26 | obj.bundleFrom = @"Home"; 27 | }]; 28 | [f addObject:row]; 29 | } 30 | { 31 | CD_Row *row = [CD_Row rowWithViewClass:[Cell_TableViewClass class] then:^(CD_Row * _Nonnull obj) { 32 | obj.viewData = @"Cell_TableViewClass"; 33 | obj.config = [UIColor blueColor]; 34 | obj.height = 130; 35 | 36 | }]; 37 | [f addObject:row]; 38 | } 39 | { 40 | CD_Row *row = [CD_Row rowWithViewClass:[Cell_TableViewXib class] then:^(CD_Row * _Nonnull obj) { 41 | obj.viewData = @"Cell_TableViewXib"; 42 | obj.config = [UIColor orangeColor]; 43 | obj.height = 60; 44 | obj.bundleFrom = @"Home"; 45 | }]; 46 | row.callback = ^(id _Nonnull any) { 47 | NSLog(@"点击了 %@ Button", any); 48 | }; 49 | [f addObject:row]; 50 | } 51 | [self.forms addObject:f]; 52 | 53 | if (self.reloadData) { 54 | self.reloadData(); 55 | } 56 | 57 | } 58 | 59 | - (void)requestData:(BOOL)refresh { 60 | [self makeForm]; 61 | } 62 | @end 63 | -------------------------------------------------------------------------------- /Example/CD_ObjC/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/CD_ObjC/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 | -------------------------------------------------------------------------------- /CaamDauObjC/Form/CD_Row.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "CD_Row.h" 4 | 5 | @interface CD_Row() 6 | @property(nonatomic, copy, readwrite) NSString *identifier; 7 | @end 8 | 9 | @implementation CD_Row 10 | - (void)setSize:(CGSize)size{ 11 | self.frame = CGRectMake(0, 0, size.width, size.height); 12 | } 13 | - (CGSize)size{ 14 | return CGSizeMake(self.frame.size.width, self.frame.size.height); 15 | } 16 | - (void)setHeight:(CGFloat)height{ 17 | self.frame = CGRectMake(0, 0, 0, height); 18 | } 19 | - (CGFloat)height{ 20 | return self.frame.size.height; 21 | } 22 | 23 | - (NSString *)bundleFrom { 24 | if (!_bundleFrom) { 25 | _bundleFrom = @""; 26 | } 27 | return _bundleFrom; 28 | } 29 | 30 | - (instancetype)initWithViewClass:(Class)cls then:(void (^)(__weak CD_Row * _Nonnull obj))then { 31 | if (self = [super init]) { 32 | self.viewClass = cls; 33 | if (then) { 34 | then(self); 35 | } 36 | } 37 | return self; 38 | } 39 | + (instancetype)rowWithViewClass:(Class)cls then:(void (^)(__weak CD_Row * _Nonnull obj))then { 40 | return [[CD_Row alloc] initWithViewClass:cls then:then]; 41 | } 42 | 43 | - (instancetype)init 44 | { 45 | self = [super init]; 46 | if (self) { 47 | 48 | } 49 | return self; 50 | } 51 | 52 | - (void)bindView:(UIView *)view { 53 | if (![view conformsToProtocol:@protocol(CD_RowDelegate)]) { 54 | return; 55 | } 56 | 57 | if ([view respondsToSelector:@selector(row_updateConfig:)]) { 58 | [view performSelector:@selector(row_updateConfig:) withObject:self.config]; 59 | } 60 | 61 | if ([view respondsToSelector:@selector(row_updateViewData:)]) { 62 | [view performSelector:@selector(row_updateViewData:) withObject:self.viewData]; 63 | } 64 | 65 | if (self.callback && [view respondsToSelector:@selector(row_callback:)]) 66 | { 67 | [view performSelector:@selector(row_callback:) withObject:self.callback]; 68 | } 69 | } 70 | 71 | - (NSString *)identifier { 72 | return _identifier ? _identifier : NSStringFromClass(self.viewClass); 73 | } 74 | @end 75 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIButton+Chain.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface UIButton (Chain) 5 | - (UIButton * (NS_NOESCAPE ^)(NSString *))cd_title; 6 | - (UIButton * (NS_NOESCAPE ^)(NSString *, UIControlState))cd_titleState; 7 | - (UIButton * (NS_NOESCAPE ^)(UIColor *))cd_titleColor; 8 | - (UIButton * (NS_NOESCAPE ^)(UIColor *, UIControlState))cd_titleColorState; 9 | - (UIButton * (NS_NOESCAPE ^)(UIFont *))cd_titleFont; 10 | - (UIButton * (NS_NOESCAPE ^)(BOOL))cd_enabled; 11 | - (UIButton * (NS_NOESCAPE ^)(UIImage *))cd_image; 12 | - (UIButton * (NS_NOESCAPE ^)(UIImage *, UIControlState))cd_imageState; 13 | - (UIButton * (NS_NOESCAPE ^)(UIImage *))cd_bgImage; 14 | - (UIButton * (NS_NOESCAPE ^)(UIImage *, UIControlState))cd_bgImageState; 15 | - (UIButton * (NS_NOESCAPE ^)(NSAttributedString *))cd_attributedTitle; 16 | - (UIButton * (NS_NOESCAPE ^)(NSAttributedString *, UIControlState))cd_attributedTitleState; 17 | - (UIButton * (NS_NOESCAPE ^)(CGFloat , CGFloat, CGFloat, CGFloat))cd_titleEdgeInsets; 18 | - (UIButton * (NS_NOESCAPE ^)(CGFloat , CGFloat, CGFloat, CGFloat))cd_imageEdgeInsets; 19 | - (UIButton * (NS_NOESCAPE ^)(UIControlContentHorizontalAlignment))cd_contentHorizontalAlignment; 20 | - (UIButton * (NS_NOESCAPE ^)(UIControlContentVerticalAlignment))cd_contentVerticalAlignment; 21 | - (UIButton * (NS_NOESCAPE ^)(BOOL))cd_reversesTitleShadowWhenHighlighted; 22 | - (UIButton * (NS_NOESCAPE ^)(BOOL))cd_adjustsImageWhenHighlighted; 23 | - (UIButton * (NS_NOESCAPE ^)(BOOL))cd_adjustsImageWhenDisabled; 24 | - (UIButton * (NS_NOESCAPE ^)(BOOL))cd_showsTouchWhenHighlighted; 25 | /// 向Button上添加 Activity loading 26 | - (UIButton * (NS_NOESCAPE ^)(UIColor *bg, UIActivityIndicatorViewStyle st))cd_loading; 27 | /// 向Button上添加 Activity loading 自设坐标 28 | - (UIButton * (^)(UIColor *bg, UIColor *act, UIActivityIndicatorViewStyle st, CGPoint po))cd_loadingC; 29 | /// 将 loading remove 30 | - (UIButton * (NS_NOESCAPE ^)(void))cd_loadingHidden; 31 | 32 | /// 向Button上添加 自定义 loading 33 | - (UIButton * (NS_NOESCAPE ^)(void (^)(void)))cd_loadingCustom; 34 | /// 将 指定 loading remove 配合 cd_loadingCustom 使用 35 | - (UIButton * (NS_NOESCAPE ^)(NSInteger))cd_loadingHiddenTag; 36 | @end 37 | -------------------------------------------------------------------------------- /Example/CD_ObjC/CDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDAppDelegate.m 3 | // CD_ObjC 4 | // 5 | // Created by liucaide on 12/15/2018. 6 | // Copyright (c) 2018 liucaide. All rights reserved. 7 | // 8 | 9 | #import "CDAppDelegate.h" 10 | 11 | @implementation CDAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/UICollectionView+CD.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "UICollectionView+CD.h" 4 | #import "NSBundle+CD.h" 5 | @implementation UICollectionView (CD) 6 | 7 | - (UICollectionViewCell *)cd_cell:(Class)cell indexPath:(NSIndexPath*)index{ 8 | return [self dequeueReusableCellWithReuseIdentifier:NSStringFromClass(cell) forIndexPath:index]; 9 | } 10 | 11 | - (UICollectionReusableView *)cd_view:(Class)cell indexPath:(NSIndexPath*)index kind:(NSString*)kind{ 12 | return [self dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:NSStringFromClass(cell) forIndexPath:index]; 13 | } 14 | 15 | - (void)cd_registerClass:(Class)cell bundleFrom:(NSString*)from{ 16 | NSString *identifier = NSStringFromClass(cell); 17 | if (from.length == 0) { 18 | NSString *bu = [[NSBundle mainBundle] pathForResource:identifier ofType:@"nib"]; 19 | if (bu) { 20 | UINib *nib = [UINib nibWithNibName:identifier bundle:nil]; 21 | [self registerNib:nib forCellWithReuseIdentifier:identifier]; 22 | }else{ 23 | [self registerClass:cell forCellWithReuseIdentifier:NSStringFromClass(cell)]; 24 | } 25 | }else { 26 | UINib* nib = [UINib nibWithNibName:identifier bundle:[NSBundle cd_bundleWithClass:cell forResource:from]]; 27 | [self registerNib:nib forCellWithReuseIdentifier:identifier]; 28 | } 29 | } 30 | 31 | - (void)cd_registerView:(Class)view bundleFrom:(NSString*)from kind:(NSString*)kind{ 32 | NSString *identifier = NSStringFromClass(view); 33 | if (from.length == 0) { 34 | NSString *bu = [[NSBundle mainBundle] pathForResource:identifier ofType:@"nib"]; 35 | if (bu) { 36 | UINib *nib = [UINib nibWithNibName:identifier bundle:nil]; 37 | [self registerNib:nib forSupplementaryViewOfKind:kind withReuseIdentifier:identifier]; 38 | }else{ 39 | [self registerClass:view forSupplementaryViewOfKind:kind withReuseIdentifier:identifier]; 40 | } 41 | }else { 42 | UINib* nib = [UINib nibWithNibName:identifier bundle:[NSBundle cd_bundleWithClass:view forResource:from]]; 43 | [self registerNib:nib forSupplementaryViewOfKind:kind withReuseIdentifier:identifier]; 44 | } 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIAlertController+Chain.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface UIAlertController (Chain) 6 | #pragma mark ----- 初始化 7 | /// 初始化 样式 Alert 8 | + (UIAlertController*)cd_alert; 9 | /// 初始化 样式 ActionSheet 10 | + (UIAlertController*)cd_sheet; 11 | /// 初始化 12 | + (UIAlertController*)cd_alert:(UIAlertControllerStyle)style; 13 | 14 | #pragma mark ----- 显示 15 | /// 显示 传入 vc 16 | - (UIAlertController *(NS_NOESCAPE ^)(UIViewController* ))cd_show; 17 | /// 显示 present 完成后 自定义内容 completion 18 | - (UIAlertController *(NS_NOESCAPE ^)(UIViewController* vc, void (^block)(void)))cd_showBlock; 19 | 20 | #pragma mark ----- 消失 21 | /// 消失 默认 1.0 秒后 22 | - (void (^)(void))cd_hidden; 23 | /// 消失 默认 1.0 秒后 消失后回调 Completion 自定义内容 24 | - (void(^)(void (^)(void)))cd_hiddenBlock; 25 | /// 消失 设置延时时间 消失后回调 block 自定义内容 26 | - (void(^)(NSTimeInterval time, void (^block)(void)))cd_hiddenTimeBlock; 27 | 28 | #pragma mark ----- 标题样式 29 | /// 设置标题 30 | - (UIAlertController *(NS_NOESCAPE ^)(NSString*))cd_title; 31 | /// 设置标题字体 32 | - (UIAlertController *(NS_NOESCAPE ^)(UIFont*))cd_titleFont; 33 | /// 设置标题颜色 34 | - (UIAlertController *(NS_NOESCAPE ^)(UIColor*))cd_titleColor; 35 | /// 设置标题 自定义富文本 36 | - (UIAlertController *(NS_NOESCAPE ^)(NSAttributedString*))cd_titleAttributed; 37 | //#pragma mark ----- Msg 样式 38 | /// 设置副标题 39 | - (UIAlertController *(NS_NOESCAPE ^)(NSString*))cd_message; 40 | /// 设置副标题字体 41 | - (UIAlertController *(NS_NOESCAPE ^)(UIFont*))cd_messageFont; 42 | /// 设置副标题颜色 43 | - (UIAlertController *(NS_NOESCAPE ^)(UIColor*))cd_messageColor; 44 | /// 设置副标题 自定义富文本 45 | - (UIAlertController *(NS_NOESCAPE ^)(NSString*))cd_messageAttributed; 46 | #pragma mark ----- 按钮 47 | /// 按钮 48 | - (UIAlertController *(NS_NOESCAPE ^)(NSString*text, void (^handler)(void)))cd_action; 49 | 50 | /// 按钮 + 自定义 回调包含在内 51 | - (UIAlertController *(^)(void(^)(UIAlertAction * action)))cd_actionCustom; 52 | @end 53 | 54 | @interface UIAlertAction (Chain) 55 | /// 设置按钮文字 56 | - (UIAlertAction *(NS_NOESCAPE ^)(NSString*))cd_text; 57 | /// 设置按钮 字体色 58 | - (UIAlertAction *(NS_NOESCAPE ^)(UIColor*))cd_textColor; 59 | /// 设置按钮 样式 UIAlertActionStyle 60 | - (UIAlertAction *(NS_NOESCAPE ^)(UIAlertActionStyle))cd_style; 61 | /// 点击回调 62 | - (UIAlertAction *(^)(void(^handler)(UIAlertAction * _Nonnull action)))cd_handler; 63 | @end 64 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIImageView+Chain.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "UIImageView+Chain.h" 4 | 5 | @implementation UIImageView (Chain) 6 | 7 | - (UIImageView * (^)(UIImage *))cd_image{ 8 | return ^(UIImage *a){ 9 | self.image = a; 10 | return self; 11 | }; 12 | } 13 | 14 | - (UIImageView * (^)(UIImage *))cd_highlightedImage{ 15 | return ^(UIImage *a){ 16 | self.highlightedImage = a; 17 | return self; 18 | }; 19 | } 20 | 21 | - (UIImageView * (^)(BOOL))cd_highlighted{ 22 | return ^(BOOL a){ 23 | self.highlighted = a; 24 | return self; 25 | }; 26 | } 27 | 28 | - (UIImageView * (^)(NSArray *))cd_animationImages{ 29 | return ^(NSArray * a){ 30 | self.animationImages = a; 31 | return self; 32 | }; 33 | } 34 | - (UIImageView * (^)(NSArray *))cd_highlightedAnimationImages{ 35 | return ^(NSArray * a){ 36 | self.highlightedAnimationImages = a; 37 | return self; 38 | }; 39 | } 40 | 41 | - (UIImageView * (^)(NSTimeInterval))cd_animationDuration{ 42 | return ^(NSTimeInterval a){ 43 | self.animationDuration = a; 44 | return self; 45 | }; 46 | } 47 | 48 | - (UIImageView * (^)(NSInteger))cd_animationRepeatCount{ 49 | return ^(NSInteger a){ 50 | self.animationRepeatCount = a; 51 | return self; 52 | }; 53 | } 54 | - (UIImageView * (^)(void))cd_startAnimating{ 55 | return ^(void){ 56 | [self startAnimating]; 57 | return self; 58 | }; 59 | } 60 | - (UIImageView * (^)(void))cd_stopAnimating{ 61 | return ^(void){ 62 | [self stopAnimating]; 63 | return self; 64 | }; 65 | } 66 | 67 | - (UIImageView * (^)(NSArray *names, NSTimeInterval t))cd_animateImageNames{ 68 | return ^(NSArray * imgs, NSTimeInterval time){ 69 | NSMutableArray *imgArray = [NSMutableArray array]; 70 | for (NSString * n in imgs) { 71 | UIImage *image = [UIImage imageNamed:n]; 72 | [imgArray addObject:image]; 73 | } 74 | self.animationImages = imgArray; 75 | self.animationDuration = time; 76 | self.animationRepeatCount = 1; 77 | [self startAnimating]; 78 | return self; 79 | }; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/UITableView+CD.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "UITableView+CD.h" 4 | #import "NSBundle+CD.h" 5 | @implementation UITableView (CD) 6 | 7 | - (UITableViewCell *)cd_cell:(Class)cell bundleFrom:(NSString*)from{ 8 | NSString *identifier = NSStringFromClass(cell); 9 | UITableViewCell *item = [self dequeueReusableCellWithIdentifier:identifier]; 10 | if (!item) { 11 | if (from.length == 0) { 12 | NSString * bundle = [[NSBundle mainBundle] pathForResource:NSStringFromClass(cell) ofType:@"nib"]; 13 | if (bundle) { 14 | UINib *nib = [UINib nibWithNibName:identifier bundle:nil]; 15 | 16 | [self registerNib:nib forCellReuseIdentifier:identifier]; 17 | }else{ 18 | [self registerClass:cell forCellReuseIdentifier:identifier]; 19 | } 20 | }else{ 21 | UINib* nib = [UINib nibWithNibName:identifier bundle:[NSBundle cd_bundleWithClass:cell forResource:from]]; 22 | [self registerNib:nib forCellReuseIdentifier:identifier]; 23 | } 24 | item = [self dequeueReusableCellWithIdentifier:identifier]; 25 | } 26 | return item; 27 | } 28 | 29 | - (UITableViewHeaderFooterView*)cd_view:(Class)view bundleFrom:(NSString*)from{ 30 | NSString *identifier = NSStringFromClass(view); 31 | UITableViewHeaderFooterView *v = [self dequeueReusableHeaderFooterViewWithIdentifier:identifier]; 32 | if (!v) { 33 | if (from.length == 0) { 34 | NSString * bundle = [[NSBundle mainBundle] pathForResource:NSStringFromClass(view) ofType:@"nib"]; 35 | if (bundle) { 36 | UINib *nib = [UINib nibWithNibName:identifier bundle:nil]; 37 | [self registerNib:nib forHeaderFooterViewReuseIdentifier:identifier]; 38 | }else{ 39 | [self registerClass:view forHeaderFooterViewReuseIdentifier:identifier]; 40 | } 41 | }else{ 42 | UINib* nib = [UINib nibWithNibName:identifier bundle:[NSBundle cd_bundleWithClass:view forResource:from]]; 43 | [self registerNib:nib forHeaderFooterViewReuseIdentifier:identifier]; 44 | } 45 | v = [self dequeueReusableHeaderFooterViewWithIdentifier:identifier]; 46 | } 47 | 48 | return v; 49 | } 50 | @end 51 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIView+Chain.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface UIView (Chain) 6 | + (instancetype)cd_init; 7 | 8 | - (UIView *(NS_NOESCAPE ^)(CGRect))cd_frame; 9 | - (UIView *(NS_NOESCAPE ^)(CGRect ))cd_bounds; 10 | - (UIView *(NS_NOESCAPE ^)(CGPoint ))cd_center; 11 | - (UIView *(NS_NOESCAPE ^)(NSInteger))cd_tag; 12 | - (UIView *(NS_NOESCAPE ^)(BOOL))cd_hidden; 13 | - (UIView *(NS_NOESCAPE ^)(BOOL))cd_userInteractionEnabled; 14 | - (UIView *(NS_NOESCAPE ^)(UIViewContentMode))cd_contentMode; 15 | /// 背景颜色 16 | - (UIView *(NS_NOESCAPE ^)(UIColor*))cd_bgColor; 17 | 18 | - (UIView *(NS_NOESCAPE ^)(UIColor*))cd_tintColor; 19 | - (UIView *(NS_NOESCAPE ^)(CGFloat))cd_borderWidth; 20 | - (UIView *(NS_NOESCAPE ^)(UIColor*))cd_borderColor; 21 | - (UIView *(NS_NOESCAPE ^)(CGFloat))cd_cornerRadius; 22 | - (UIView *(NS_NOESCAPE ^)(BOOL))cd_clipsToBounds; 23 | - (UIView *(NS_NOESCAPE ^)(CGFloat, BOOL))cd_radius_clips; 24 | /** 25 | * 设置部分圆角(绝对布局) 26 | * 27 | * @param corners 圆角类型组 UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners 28 | * @param radii 圆角大小 例如 CGSizeMake(20.0f, 20.0f) 29 | */ 30 | /// 设置部分圆角(绝对布局) 31 | - (UIView *(NS_NOESCAPE ^)(UIRectCorner, CGSize))cd_byRoundedCornersRadii; 32 | /** 33 | * 设置部分圆角(相对布局) 34 | * @param rect 圆角view的rect 35 | * @param corners 圆角类型组 UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners 36 | * @param radii 圆角大小 例如 CGSizeMake(20.0f, 20.0f) 37 | * 38 | */ 39 | /// 设置部分圆角(相对布局) 40 | - (UIView *(NS_NOESCAPE ^)(UIRectCorner, CGSize, CGRect))cd_byRoundedRectCornersRadii; 41 | 42 | /// 变形属性(平移\缩放\旋转) 43 | - (UIView *(NS_NOESCAPE ^)(CGAffineTransform))cd_transform; 44 | /// 自动调整子视图尺寸,默认YES则会根据autoresizingMask属性自动调整子视图尺寸 45 | - (UIView *(NS_NOESCAPE ^)(BOOL))cd_autoresizesSubviews; 46 | /// 自动调整子视图与父视图的位置,默认UIViewAutoresizingNone 47 | - (UIView *(NS_NOESCAPE ^)(UIViewAutoresizing))cd_autoresizingMask; 48 | 49 | - (UIView *(NS_NOESCAPE ^)(UIColor *))cd_shadowColor; 50 | - (UIView *(NS_NOESCAPE ^)(CGSize))cd_shadowOffset; 51 | - (UIView *(NS_NOESCAPE ^)(float))cd_shadowOpacity; 52 | - (UIView *(NS_NOESCAPE ^)(CGFloat))cd_shadowRadius; 53 | - (UIView *(NS_NOESCAPE ^)(CGPathRef))cd_shadowPath; 54 | - (UIView *(NS_NOESCAPE ^)(UIView *))cd_addSubView; 55 | 56 | 57 | - (UIView * (NS_NOESCAPE ^)(BOOL))cd_opaque; 58 | - (UIView * (NS_NOESCAPE ^)(CGFloat))cd_alpha; 59 | - (UIView * (NS_NOESCAPE ^)(BOOL))cd_masksToBounds; 60 | - (UIView * (^)(UIEdgeInsets))cd_layoutMargins; 61 | 62 | - (UIView * (NS_NOESCAPE ^)(UIGestureRecognizer *))cd_addGestureRecognizer; 63 | - (UIView * (NS_NOESCAPE ^)(NSLayoutConstraint *))cd_addConstraint; 64 | - (UIView * (NS_NOESCAPE ^)(NSArray<__kindof NSLayoutConstraint *> *))cd_addConstraints; 65 | @end 66 | -------------------------------------------------------------------------------- /Example/Module/Home/Home/Nib/Cell_TableViewXib.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /CaamDauObjC/Categories/UIViewController+CD.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+CD.m 3 | // CDKit_OCDemo 4 | // 5 | // Created by LCD on 2017/11/17. 6 | // Copyright © 2017年 LCD. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+CD.h" 10 | #import "NSBundle+CD.h" 11 | 12 | @implementation UIViewController (CD) 13 | 14 | + (instancetype)cd_init { 15 | return [[self alloc] init]; 16 | } 17 | 18 | + (instancetype)cd_storyboard { 19 | return [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:NSStringFromClass(self)]; 20 | } 21 | 22 | + (instancetype)cd_storyboard:(NSString*)name{ 23 | return [[UIStoryboard storyboardWithName:name bundle:nil] instantiateViewControllerWithIdentifier:NSStringFromClass(self)]; 24 | } 25 | 26 | + (instancetype)cd_storyboard:(NSString*)name bundleForm:(NSString*)form{ 27 | return [[UIStoryboard storyboardWithName:name bundle:[NSBundle cd_bundleWithClass:self forResource:form]] instantiateViewControllerWithIdentifier:NSStringFromClass(self)]; 28 | } 29 | 30 | #pragma mark ----- Function 获取当前控制器 ----- 31 | + (UIViewController *)cd_getViewController{ 32 | UIViewController *rootViewController =[[[[UIApplication sharedApplication] delegate] window] rootViewController]; 33 | return [UIViewController cd_getVisibleVCFrom:rootViewController]; 34 | } 35 | + (UIViewController *) cd_getVisibleVCFrom:(UIViewController *) vc { 36 | if ([vc isKindOfClass:[UINavigationController class]]) { 37 | return [UIViewController cd_getVisibleVCFrom:[((UINavigationController *) vc) visibleViewController]]; 38 | } else if ([vc isKindOfClass:[UITabBarController class]]) { 39 | return [UIViewController cd_getVisibleVCFrom:[((UITabBarController *) vc) selectedViewController]]; 40 | } else { 41 | if (vc.presentedViewController) { 42 | return [UIViewController cd_getVisibleVCFrom:vc.presentedViewController]; 43 | } else { 44 | return vc; 45 | } 46 | } 47 | } 48 | + (UIViewController*)cd_getTopVCWithRootVC:(UIViewController*)rootViewController { 49 | if ([rootViewController isKindOfClass:[UITabBarController class]]) { 50 | 51 | UITabBarController* tabBarController = (UITabBarController*)rootViewController; 52 | return [UIViewController cd_getTopVCWithRootVC:tabBarController.selectedViewController]; 53 | } else if (rootViewController.presentedViewController) { 54 | 55 | UIViewController* presentedViewController = rootViewController.presentedViewController; 56 | return [UIViewController cd_getTopVCWithRootVC:presentedViewController]; 57 | } else if ([rootViewController isKindOfClass:[UINavigationController class]]) { 58 | UINavigationController* navigationController = (UINavigationController*)rootViewController; 59 | return [UIViewController cd_getTopVCWithRootVC:navigationController.visibleViewController]; 60 | } else { 61 | return rootViewController; 62 | } 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CaamDauObjC ([Swift 版本在这里](https://github.com/liucaide/CaamDau)) 2 | 3 | [![CI Status](https://img.shields.io/travis/liucaide/CaamDauObjC.svg?style=flat)](https://travis-ci.org/liucaide/CaamDauObjC) 4 | [![Version](https://img.shields.io/cocoapods/v/CaamDauObjC.svg?style=flat)](https://cocoapods.org/pods/CaamDauObjC) 5 | [![License](https://img.shields.io/cocoapods/l/CaamDauObjC.svg?style=flat)](https://cocoapods.org/pods/CaamDauObjC) 6 | [![Platform](https://img.shields.io/cocoapods/p/CaamDauObjC.svg?style=flat)](https://cocoapods.org/pods/CaamDauObjC) 7 | # 》目前更多关注于Swift版本,OC版本剩余组件暂不整理更新 8 | ## 目录 9 | - [CaauDau核心组件](#CaauDau核心组件) 10 | - [Form流式模型化排版组件](#Form流式模型化排版组件) 11 | - [Chain链式调用组件](#Chain链式调用组件) 12 | - [Categories便利性扩展](#Categories便利性扩展) 13 | - [CaauDau第三方扩展组件](#CaauDau第三方扩展组件) 14 | - [MJRefresh扩展](#MJRefresh扩展) 15 | 16 | ```ruby 17 | pod 'CaamDauObjC' 18 | ``` 19 | ## CaauDau核心组件 20 | ### Form流式模型化排版组件 21 | - 将 delegate、dataSource 设置为 CD_FormTableViewDelegateDataSource 22 | - 当然也可设置为 self ,只需将 CD_FormTableViewDelegateDataSource 内的方法完全复制过来,而不需要做任何更改 23 | ``` 24 | - (VM_TableViewForm *)vm { 25 | if (!_vm) { 26 | _vm = [VM_TableViewForm new]; 27 | } 28 | return _vm; 29 | } 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | 33 | self.delegateData = [[CD_FormTableViewDelegateDataSource alloc] initWithForm:self.vm]; 34 | self.tableView.delegate = self.delegateData; 35 | self.tableView.dataSource = self.delegateData; 36 | [self.delegateData makeTableView:self.tableView]; 37 | 38 | __weak typeof(self) weakSelf = self; 39 | [self.tableView cd_headerAddMJRefresh:^{ 40 | __strong typeof(weakSelf) strongSelf = weakSelf; 41 | [strongSelf.vm requestData:YES]; 42 | [strongSelf.tableView cd_endRefreshing]; 43 | }]; 44 | [self.tableView cd_beginRefreshing]; 45 | } 46 | ``` 47 | - 构建单元格模型:将多点关系的 delegate dataSource 现在转化为单点关系的 模型单元 48 | ``` 49 | {// 将多点关系的 delegate dataSource 现在转化为单点关系的 模型单元 50 | CD_Row *row = [CD_Row rowWithViewClass:[Cell_TableViewXib class] then:^(CD_Row * _Nonnull obj) { 51 | obj.viewData = @"Cell_TableViewXib"; 52 | obj.config = [UIColor orangeColor]; 53 | obj.height = 60; 54 | obj.bundleFrom = @"Home"; 55 | }]; 56 | row.callback = ^(id _Nonnull any) { 57 | NSLog(@"点击了 %@ Button", any); 58 | }; 59 | [f addObject:row]; 60 | } 61 | [self.forms addObject:f]; 62 | 63 | if (self.reloadData) { 64 | self.reloadData(); 65 | } 66 | ``` 67 | ### Chain链式调用组件 68 | ``` 69 | UIAlertController.cd_alert 70 | .cd_title(@"提示") 71 | .cd_actionCustom(^(UIAlertAction * a){ 72 | a.cd_text(@"以后再说").cd_textColor(color_Txt_3()); 73 | }) 74 | .cd_actionCustom(^(UIAlertAction * a){ 75 | a.cd_text(@"给个好评") 76 | .cd_textColor(color_Main_1()) 77 | .cd_handler(^(UIAlertAction * b){ 78 | ..... 79 | }); 80 | }) 81 | .cd_show(); 82 | ``` 83 | ### Categories便利性扩展 84 | ``` 85 | ``` 86 | 87 | ## CaauDau第三方扩展组件 88 | ### MJRefresh扩展 89 | ``` 90 | [self.tableView cd_headerAddMJRefresh:^{ 91 | @strongify(self); 92 | [self.vm requestDataList:YES]; 93 | }]; 94 | [self.tableView cd_footerAddMJRefreshAuto:^{ 95 | @strongify(self); 96 | [self.vm requestDataList:NO]; 97 | }]; 98 | ``` 99 | 100 | 101 | 102 | 103 | ## Author 104 | 105 | - Email:565726319@qq.com 106 | - QQ & Wechat:565726319 107 | 108 | ## License 109 | 110 | CaamDauObjC is available under the MIT license. See the LICENSE file for more info. 111 | -------------------------------------------------------------------------------- /CaamDauObjC/MJRefresh/CD_MJRefreshModel.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface CD_MJRefreshModel : NSObject 5 | /// 下拉 6 | @property (nonatomic, strong) NSString *down_txtIdle; 7 | /// 下拉 8 | @property (nonatomic, strong) NSString *down_txtPulling; 9 | /// 下拉 10 | @property (nonatomic, strong) NSString *down_txtWillRefresh; 11 | /// 下拉 12 | @property (nonatomic, strong) NSString *down_txtRefreshing; 13 | /// 下拉 14 | @property (nonatomic, strong) NSString *down_txtNoMoreData; 15 | 16 | /// 下拉刷新状态的Label字体 17 | @property (nonatomic, strong) UIFont * down_txtFont; 18 | /// 下拉刷新状态的Label文字颜色 19 | @property (nonatomic, strong) UIColor * down_txtColor; 20 | /// 下拉刷新状态的Label是否隐藏 21 | @property (nonatomic, assign) BOOL down_txtHidden; 22 | /// 下拉刷新状态的time字体 23 | @property (nonatomic, strong) UIFont * down_timeFont; 24 | /// 下拉刷新状态的time文字颜色 25 | @property (nonatomic, strong) UIColor * down_timeColor; 26 | /// 下拉刷新状态的time是否隐藏 27 | @property (nonatomic, assign) BOOL down_timeHidden; 28 | /// 下拉文字和图片间的距离 29 | @property (nonatomic, assign) CGFloat down_leftInset; 30 | /// 下拉菊花样式 31 | @property (nonatomic, assign) UIActivityIndicatorViewStyle down_activityStyle; 32 | /// 下拉时间格式自定义 33 | @property (nonatomic, copy) NSString * (^down_timeText)(NSDate*); 34 | 35 | /// 下拉 36 | @property (nonatomic, strong) NSArray *down_imgIdle; 37 | /// 下拉 38 | @property (nonatomic, strong) NSArray *down_imgPulling; 39 | /// 下拉 40 | @property (nonatomic, strong) NSArray *down_imgWillRefresh; 41 | /// 下拉 42 | @property (nonatomic, strong) NSArray *down_imgRefreshing; 43 | /// 下拉 44 | @property (nonatomic, strong) NSArray *down_imgNoMoreData; 45 | 46 | 47 | 48 | /// 上拉 49 | @property (nonatomic, strong) NSString *up_txtIdle; 50 | /// 上拉 51 | @property (nonatomic, strong) NSString *up_txtPulling; 52 | /// 上拉 53 | @property (nonatomic, strong) NSString *up_txtWillRefresh; 54 | /// 上拉 55 | @property (nonatomic, strong) NSString *up_txtRefreshing; 56 | /// 上拉 57 | @property (nonatomic, strong) NSString *up_txtNoMoreData; 58 | 59 | /// 上拉 60 | @property (nonatomic, strong) NSArray *up_imgIdle; 61 | /// 上拉 62 | @property (nonatomic, strong) NSArray *up_imgPulling; 63 | /// 上拉 64 | @property (nonatomic, strong) NSArray *up_imgWillRefresh; 65 | /// 上拉 66 | @property (nonatomic, strong) NSArray *up_imgRefreshing; 67 | /// 上拉 68 | @property (nonatomic, strong) NSArray *up_imgNoMoreData; 69 | 70 | /// 上拉刷新状态的Label字体 71 | @property (nonatomic, strong) UIFont * up_txtFont; 72 | /// 上拉刷新状态的Label文字颜色 73 | @property (nonatomic, strong) UIColor * up_txtColor; 74 | /// 上拉刷新状态的Label是否隐藏 75 | @property (nonatomic, assign) BOOL up_txtHidden; 76 | /// 上拉文字和图片间的距离 77 | @property (nonatomic, assign) CGFloat up_leftInset; 78 | /// 上拉菊花样式 79 | @property (nonatomic, assign) UIActivityIndicatorViewStyle up_activityStyle; 80 | 81 | 82 | /// 是否禁止自动加载 83 | @property (nonatomic, assign) BOOL isAutoRefresh; 84 | /// 忽略多少scrollView的contentInset的bottom 85 | @property (nonatomic, assign) CGFloat ignoredContentInsetBottom; 86 | /// 忽略多少scrollView的contentInset的Top 87 | @property (nonatomic, assign) CGFloat ignoredContentInsetTop; 88 | /// 当底部控件出现多少时就自动刷新 89 | @property (nonatomic, assign) CGFloat autoRefreshPercent; 90 | /// 是否每一次拖拽只发一次请求 91 | @property (nonatomic, assign) BOOL onlyRefreshPerDrag; 92 | 93 | 94 | @end 95 | 96 | /* 97 | #pragma mark ----- 全局单例 98 | @interface CD_MJRefreshManage : NSObject 99 | 100 | -(nonnull instancetype)init NS_UNAVAILABLE; 101 | + (nonnull instancetype)new NS_UNAVAILABLE; 102 | + (instancetype)shared; 103 | 104 | @property (strong, nonatomic) CD_MJRefreshModel * model; 105 | 106 | @end 107 | */ 108 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UILabel+Chain.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "UILabel+Chain.h" 4 | 5 | @implementation UILabel (Chain) 6 | - (UILabel * (^)(NSString *))cd_text{ 7 | return ^(NSString * a){ 8 | self.text = a; 9 | return self; 10 | }; 11 | } 12 | 13 | - (UILabel * (^)(UIColor *))cd_textColor{ 14 | return ^(UIColor * a){ 15 | self.textColor = a; 16 | return self; 17 | }; 18 | } 19 | - (UILabel * (^)(UIFont *))cd_font{ 20 | return ^(UIFont * a){ 21 | self.font = a; 22 | return self; 23 | }; 24 | } 25 | - (UILabel * (^)(NSTextAlignment))cd_alignment{ 26 | return ^(NSTextAlignment a){ 27 | self.textAlignment = a; 28 | return self; 29 | }; 30 | } 31 | - (UILabel * (^)(NSInteger))cd_numberOfLines{ 32 | return ^(NSInteger a){ 33 | self.numberOfLines = a; 34 | return self; 35 | }; 36 | } 37 | 38 | - (UILabel * (^)(NSAttributedString *))cd_attributedText{ 39 | return ^(NSAttributedString * a){ 40 | self.attributedText = a; 41 | return self; 42 | }; 43 | } 44 | - (UILabel * (^)(CGFloat))cd_lineSpacing{ 45 | return ^(CGFloat a){ 46 | //富文本属性 47 | NSMutableDictionary *textDict = [NSMutableDictionary dictionary]; 48 | //基本属性设置 49 | //字体颜色 50 | textDict[NSForegroundColorAttributeName] = self.textColor; 51 | //字号大小 52 | textDict[NSFontAttributeName] = self.font; 53 | //段落样式 54 | NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init]; 55 | //行间距 56 | paraStyle.lineSpacing = a; 57 | //文本段落样式 58 | textDict[NSParagraphStyleAttributeName] = paraStyle; 59 | if(self.text.length > 0 ) { 60 | self.attributedText = [[NSAttributedString alloc] initWithString:self.text attributes:textDict]; 61 | }else if(self.attributedText.length > 0){ 62 | NSMutableAttributedString * atext = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText]; 63 | [atext setAttributes:textDict range:NSMakeRange(0, self.attributedText.length)]; 64 | self.attributedText = atext; 65 | } 66 | return self; 67 | }; 68 | } 69 | 70 | - (UILabel * (^)(NSLineBreakMode))cd_lineBreakMode{ 71 | return ^(NSLineBreakMode a){ 72 | self.lineBreakMode = a; 73 | return self; 74 | }; 75 | } 76 | 77 | - (UILabel * (^)(UIBaselineAdjustment))cd_baselineAdjustment{ 78 | return ^(UIBaselineAdjustment a){ 79 | self.baselineAdjustment = a; 80 | return self; 81 | }; 82 | } 83 | 84 | - (UILabel * (^)(BOOL))cd_allowsDefaultTighteningForTruncation{ 85 | return ^(BOOL a){ 86 | if (@available(iOS 9.0, *)) { 87 | self.allowsDefaultTighteningForTruncation = a; 88 | } else { 89 | // Fallback on earlier versions 90 | } 91 | return self; 92 | }; 93 | } 94 | 95 | - (UILabel * (^)(CGFloat))cd_preferredMaxLayoutWidth{ 96 | return ^(CGFloat a){ 97 | self.preferredMaxLayoutWidth = a; 98 | return self; 99 | }; 100 | } 101 | 102 | - (UILabel * (^)(BOOL))cd_adjustsFontSizeToFitWidth{ 103 | return ^(BOOL a){ 104 | self.adjustsFontSizeToFitWidth = a; 105 | return self; 106 | }; 107 | } 108 | 109 | - (UILabel * (^)(UIColor *))cd_highlightedTextColor{ 110 | return ^(UIColor *a){ 111 | self.highlightedTextColor = a; 112 | return self; 113 | }; 114 | } 115 | 116 | - (UILabel * (^)(CGFloat))cd_minimumScaleFactor{ 117 | return ^(CGFloat a){ 118 | self.minimumScaleFactor = a; 119 | return self; 120 | }; 121 | } 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /CaamDauObjC/MJRefresh/UIScrollView+CD_MJRefresh.h: -------------------------------------------------------------------------------- 1 | //Created on 2018/3/5 by LCD :https://github.com/liucaide . 2 | 3 | /*** 模块文档 *** 4 | 使用 示例 5 | - (void)cd_addMJRefresh{ 6 | // ---> 可单独在某一页面配置 cd_mjRefreshModel 达到与其他页面不同效果 7 | CD_MJRefreshModel *model = [CD_MJRefreshModel new]; 8 | model.labelHiddenDown = NO; 9 | model.titleRefreshingDown = @"正在刷新"; 10 | self.tableView.cd_mjRefreshModel = model; 11 | // <--- 12 | 13 | [self.tableView cd_headerAddMJRefresh:^{ 14 | @strongify(self) 15 | [self.vm requestDataRefresh:YES]; 16 | }]; 17 | [self.tableView cd_footerAddMJRefreshAuto:^{ 18 | @strongify(self) 19 | [self.vm requestDataRefresh:NO]; 20 | }]; 21 | [self.tableView cd_mjRefreshTypes:self.vm.refreshTypes]; 22 | } 23 | 24 | // ---> 当然也可以配置全局 cd_mjRefreshModel 统一刷新效果 25 | 创建一个分类 重写 cd_mjRefreshModel 的Get 方法 26 | @interface UIScrollView (CD_MJRefreshModelCustom) 27 | @end 28 | @implementation UIScrollView (CD_MJRefreshModelCustom) 29 | 30 | - (CD_MJRefreshModel *)cd_mjRefreshModel{ 31 | CD_MJRefreshModel * model = objc_getAssociatedObject(self, _cmd); 32 | if (model) { 33 | return model; 34 | }else{ 35 | model = [CD_MJRefreshModel new]; 36 | model.labelHiddenDown = NO; 37 | model.titleRefreshingDown = @"1234567"; 38 | [self setCd_mjRefreshModel:model]; 39 | } 40 | return model; 41 | } 42 | @end 43 | */ 44 | 45 | 46 | #import 47 | #import 48 | #import "CD_MJRefreshModel.h" 49 | 50 | typedef NS_ENUM(NSUInteger, CD_MJRefreshType) { 51 | /// 开始拉刷新 52 | CD_MJRefreshTypeBegin, 53 | /// 结束刷新 54 | CD_MJRefreshTypeEnd, 55 | /// 结束刷新 并不再加载 56 | CD_MJRefreshTypeNoMoreData, 57 | /// 回复上拉 58 | CD_MJRefreshTypeReset, 59 | /// 隐藏底部 60 | CD_MJRefreshTypeHiddenFoot, 61 | /// 显示底部 62 | CD_MJRefreshTypeShowFoot 63 | }; 64 | 65 | @interface UIScrollView (CD_MJRefresh) 66 | 67 | @property (nonatomic, strong) CD_MJRefreshModel * cd_mjRefreshModel UI_APPEARANCE_SELECTOR; 68 | 69 | /// 添加头部下拉刷新 70 | - (void)cd_headerAddMJRefresh:(MJRefreshComponentRefreshingBlock)block; 71 | /// 添加头部下拉刷新 Gif版 72 | - (void)cd_headerAddMJRefreshGif:(MJRefreshComponentRefreshingBlock)block; 73 | /// 添加头部下拉刷新 自定义Model样式 74 | - (void)cd_headerAddMJRefresh:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block; 75 | /// 添加头部下拉刷新 Gif 自定义Model样式 76 | - (void)cd_headerAddMJRefreshGif:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block; 77 | 78 | 79 | 80 | /// 添加底部部上拉加载 默认自动版 81 | - (void)cd_footerAddMJRefreshAuto:(MJRefreshComponentRefreshingBlock)block; 82 | /// 添加底部部上拉加载 Gif自动版 83 | - (void)cd_footerAddMJRefreshGifAuto:(MJRefreshComponentRefreshingBlock)block; 84 | /// 添加底部部上拉加载 默认手动版 85 | - (void)cd_footerAddMJRefreshBack:(MJRefreshComponentRefreshingBlock)block; 86 | /// 添加底部部上拉加载 Gif自动版 87 | - (void)cd_footerAddMJRefreshGifBack:(MJRefreshComponentRefreshingBlock)block; 88 | 89 | /// 添加底部部上拉加载 默认自动版 自定义 Model样式 90 | - (void)cd_footerAddMJRefreshAuto:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block; 91 | /// 添加底部部上拉加载 Gif自动版 自定义 Model样式 92 | - (void)cd_footerAddMJRefreshGifAuto:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block; 93 | /// 添加底部部上拉加载 默认手动版 自定义 Model样式 94 | - (void)cd_footerAddMJRefreshBack:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block; 95 | /// 添加底部部上拉加载 Gif自动版 自定义 Model样式 96 | - (void)cd_footerAddMJRefreshGifBack:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block; 97 | 98 | /// 开始刷新 99 | - (void)cd_beginRefreshing; 100 | /// 结束刷新 101 | - (void)cd_endRefreshing; 102 | /// 结束加载并不再加载 103 | - (void)cd_endRefreshingWithNoMoreData; 104 | /// 恢复加载 105 | - (void)cd_footResetNoMoreData; 106 | /// 底部上拉 是否隐藏 107 | - (void)cd_footHidden:(BOOL)hidden; 108 | /// 刷新状态 变更组合 --> CD_MJRefreshType 109 | - (void)cd_mjRefreshTypes:(NSArray*)types; 110 | @end 111 | 112 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcodeproj/xcshareddata/xcschemes/CD_ObjC-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/Module/Home/Home/Nib/HomeStoryboard.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /CaamDauObjC/MJRefresh/CD_MJRefreshModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // CD_MJRefreshModel.m 3 | // CD_Kit 4 | // 5 | // Created by LCD on 2018/3/5. 6 | // Copyright © 2018年 LCD. All rights reserved. 7 | // 8 | 9 | #import "CD_MJRefreshModel.h" 10 | 11 | @implementation CD_MJRefreshModel 12 | - (instancetype)init 13 | { 14 | self = [super init]; 15 | if(self){ 16 | [self makeDefault]; 17 | } 18 | return self; 19 | } 20 | 21 | /// 下拉 22 | - (NSString *)down_txtIdle{ 23 | return _down_txtIdle ? _down_txtIdle : @""; 24 | } 25 | /// 下拉 26 | - (NSString *)down_txtPulling{ 27 | return _down_txtPulling ? _down_txtPulling : @""; 28 | } 29 | /// 下拉 30 | - (NSString *)down_txtWillRefresh{ 31 | return _down_txtWillRefresh ? _down_txtWillRefresh : @""; 32 | } 33 | 34 | /// 下拉 35 | - (NSString *)down_txtRefreshing{ 36 | return _down_txtRefreshing ? _down_txtRefreshing : @""; 37 | } 38 | 39 | /// 下拉 40 | - (NSString *)down_txtNoMoreData{ 41 | return _down_txtNoMoreData ? _down_txtNoMoreData : @""; 42 | } 43 | 44 | /// 下拉刷新状态的Label字体 45 | - (UIFont *)down_txtFont{ 46 | return _down_txtFont ? _down_txtFont : [UIFont systemFontOfSize:14]; 47 | } 48 | /// 下拉刷新状态的Label文字颜色 49 | - (UIColor *)down_txtColor{ 50 | return _down_txtColor ? _down_txtColor : [UIColor lightGrayColor]; 51 | } 52 | 53 | /// 下拉刷新状态的time字体 54 | - (UIFont *)down_timeFont{ 55 | return _down_timeFont ? _down_timeFont : [UIFont systemFontOfSize:12]; 56 | } 57 | /// 下拉刷新状态的time文字颜色 58 | - (UIColor *)down_timeColor{ 59 | return _down_timeColor ? _down_timeColor : [UIColor lightGrayColor]; 60 | } 61 | 62 | 63 | /// 下拉 64 | - (NSArray *)down_imgIdle{ 65 | return _down_imgIdle ? _down_imgIdle : @[]; 66 | } 67 | /// 下拉 68 | - (NSArray *)down_imgPulling{ 69 | return _down_imgPulling ? _down_imgPulling : @[]; 70 | } 71 | /// 下拉 72 | - (NSArray *)down_imgWillRefresh{ 73 | return _down_imgWillRefresh ? _down_imgWillRefresh : @[]; 74 | } 75 | /// 下拉 76 | - (NSArray *)down_imgRefreshing{ 77 | return _down_imgRefreshing ? _down_imgRefreshing : @[]; 78 | } 79 | /// 下拉 80 | - (NSArray *)down_imgNoMoreData{ 81 | return _down_imgNoMoreData ? _down_imgNoMoreData : @[]; 82 | } 83 | 84 | 85 | 86 | /// 下拉 87 | - (NSString *)up_txtIdle{ 88 | return _up_txtIdle ? _up_txtIdle : @""; 89 | } 90 | /// 下拉 91 | - (NSString *)up_txtPulling{ 92 | return _up_txtPulling ? _up_txtPulling : @""; 93 | } 94 | /// 下拉 95 | - (NSString *)up_txtWillRefresh{ 96 | return _up_txtWillRefresh ? _up_txtWillRefresh : @""; 97 | } 98 | 99 | /// 下拉 100 | - (NSString *)up_txtRefreshing{ 101 | return _up_txtRefreshing ? _up_txtRefreshing : @""; 102 | } 103 | 104 | /// 下拉 105 | - (NSString *)up_txtNoMoreData{ 106 | return _up_txtNoMoreData ? _up_txtNoMoreData : @""; 107 | } 108 | 109 | /// 下拉刷新状态的Label字体 110 | - (UIFont *)up_txtFont{ 111 | return _up_txtFont ? _up_txtFont : [UIFont systemFontOfSize:14]; 112 | } 113 | /// 下拉刷新状态的Label文字颜色 114 | - (UIColor *)up_txtColor{ 115 | return _up_txtColor ? _up_txtColor : [UIColor lightGrayColor]; 116 | } 117 | 118 | 119 | 120 | /// 下拉 121 | - (NSArray *)up_imgIdle{ 122 | return _up_imgIdle ? _up_imgIdle : @[]; 123 | } 124 | /// 下拉 125 | - (NSArray *)up_imgPulling{ 126 | return _up_imgPulling ? _up_imgPulling : @[]; 127 | } 128 | /// 下拉 129 | - (NSArray *)up_imgWillRefresh{ 130 | return _up_imgWillRefresh ? _up_imgWillRefresh : @[]; 131 | } 132 | /// 下拉 133 | - (NSArray *)up_imgRefreshing{ 134 | return _up_imgRefreshing ? _up_imgRefreshing : @[]; 135 | } 136 | /// 下拉 137 | - (NSArray *)up_imgNoMoreData{ 138 | return _up_imgNoMoreData ? _up_imgNoMoreData : @[]; 139 | } 140 | 141 | 142 | 143 | - (void)makeDefault{ 144 | self.down_txtHidden = YES; 145 | self.down_timeHidden = YES; 146 | self.down_leftInset = 0; 147 | self.down_activityStyle = UIActivityIndicatorViewStyleGray; 148 | 149 | self.up_txtHidden = YES; 150 | self.up_leftInset = 0; 151 | self.up_activityStyle = UIActivityIndicatorViewStyleGray; 152 | 153 | self.isAutoRefresh = YES; 154 | self.ignoredContentInsetBottom = 0; 155 | self.ignoredContentInsetTop = 0; 156 | self.autoRefreshPercent = 1; 157 | self.onlyRefreshPerDrag = NO; 158 | } 159 | @end 160 | 161 | 162 | 163 | /* 164 | @implementation CD_MJRefreshManage 165 | + (instancetype) shared 166 | { 167 | static CD_MJRefreshManage * sharedManage; 168 | static dispatch_once_t once; 169 | dispatch_once(&once, ^{ 170 | sharedManage = [[self alloc] init]; 171 | }); 172 | return sharedManage; 173 | } 174 | 175 | - (CD_MJRefreshModel *)model{ 176 | if (!_model) { 177 | _model = [CD_MJRefreshModel new]; 178 | } 179 | return _model; 180 | } 181 | 182 | @end 183 | */ 184 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIView+Chain.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "UIView+Chain.h" 4 | 5 | @implementation UIView (Chain) 6 | + (instancetype)cd_init{ 7 | return [[self alloc] init]; 8 | } 9 | 10 | - (UIView *(^)(CGRect))cd_frame{ 11 | return ^(CGRect a) { 12 | self.frame = a; 13 | return self; 14 | }; 15 | } 16 | 17 | - (UIView *(^)(CGRect))cd_bounds{ 18 | return ^(CGRect a) { 19 | self.bounds = a; 20 | return self; 21 | }; 22 | } 23 | 24 | - (UIView *(^)(CGPoint))cd_center{ 25 | return ^(CGPoint a) { 26 | self.center = a; 27 | return self; 28 | }; 29 | } 30 | 31 | - (UIView * (^)(NSInteger))cd_tag{ 32 | return ^(NSInteger a) { 33 | self.tag = a; 34 | return self; 35 | }; 36 | } 37 | 38 | - (UIView * (^)(BOOL))cd_hidden{ 39 | return ^(BOOL a) { 40 | self.hidden = a; 41 | return self; 42 | }; 43 | } 44 | 45 | - (UIView * (^)(BOOL))cd_userInteractionEnabled{ 46 | return ^(BOOL a) { 47 | self.userInteractionEnabled = a; 48 | return self; 49 | }; 50 | } 51 | 52 | - (UIView *(^)(UIViewContentMode))cd_contentMode{ 53 | return ^(UIViewContentMode a) { 54 | self.contentMode = a; 55 | return self; 56 | }; 57 | } 58 | 59 | - (UIView *(^)(UIColor*))cd_bgColor{ 60 | return ^(UIColor* a) { 61 | self.backgroundColor = a; 62 | return self; 63 | }; 64 | } 65 | 66 | - (UIView *(^)(UIColor*))cd_tintColor{ 67 | return ^(UIColor* a) { 68 | self.tintColor = a; 69 | return self; 70 | }; 71 | } 72 | 73 | - (UIView *(^)(CGFloat))cd_borderWidth{ 74 | return ^(CGFloat a) { 75 | self.layer.borderWidth = a; 76 | return self; 77 | }; 78 | } 79 | - (UIView *(^)(UIColor*))cd_borderColor{ 80 | return ^(UIColor* a) { 81 | self.layer.borderColor = a.CGColor; 82 | return self; 83 | }; 84 | } 85 | - (UIView *(^)(CGFloat))cd_cornerRadius{ 86 | return ^(CGFloat a) { 87 | self.layer.cornerRadius = a; 88 | return self; 89 | }; 90 | } 91 | - (UIView *(^)(BOOL))cd_clipsToBounds{ 92 | return ^(BOOL a) { 93 | self.clipsToBounds = a; 94 | return self; 95 | }; 96 | } 97 | 98 | - (UIView *(^)(CGFloat, BOOL))cd_radius_clips{ 99 | return ^(CGFloat a, BOOL c) { 100 | self.layer.cornerRadius = a; 101 | self.clipsToBounds = c; 102 | return self; 103 | }; 104 | } 105 | ///设置部分圆角(绝对布局) 106 | - (UIView *(^)(UIRectCorner, CGSize))cd_byRoundedCornersRadii{ 107 | return ^(UIRectCorner a, CGSize c) { 108 | UIBezierPath* rounded = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:a cornerRadii:c]; 109 | CAShapeLayer* shape = [[CAShapeLayer alloc] init]; 110 | [shape setPath:rounded.CGPath]; 111 | self.layer.mask = shape; 112 | return self; 113 | }; 114 | } 115 | ///设置部分圆角(相对布局) 116 | - (UIView *(^)(CGRect, UIRectCorner, CGSize))cd_byRoundedRectCornersRadii{ 117 | return ^( CGRect r, UIRectCorner a, CGSize c) { 118 | UIBezierPath* rounded = [UIBezierPath bezierPathWithRoundedRect:r byRoundingCorners:a cornerRadii:c]; 119 | CAShapeLayer* shape = [[CAShapeLayer alloc] init]; 120 | [shape setPath:rounded.CGPath]; 121 | self.layer.mask = shape; 122 | return self; 123 | }; 124 | } 125 | 126 | 127 | 128 | 129 | 130 | - (UIView *(^)(UIColor *))cd_shadowColor{ 131 | return ^(UIColor *c) { 132 | self.layer.shadowColor = c.CGColor; 133 | return self; 134 | }; 135 | } 136 | - (UIView *(^)(CGSize))cd_shadowOffset{ 137 | return ^(CGSize a) { 138 | self.layer.shadowOffset = a; 139 | return self; 140 | }; 141 | } 142 | - (UIView *(^)(float))cd_shadowOpacity{ 143 | return ^(float a) { 144 | self.layer.shadowOpacity = a; 145 | return self; 146 | }; 147 | } 148 | - (UIView *(^)(CGFloat))cd_shadowRadius{ 149 | return ^(CGFloat a) { 150 | self.layer.shadowRadius = a; 151 | return self; 152 | }; 153 | } 154 | - (UIView *(^)(CGPathRef))cd_shadowPath{ 155 | return ^(CGPathRef a) { 156 | self.layer.shadowPath = a; 157 | return self; 158 | }; 159 | } 160 | /// 变形属性(平移\缩放\旋转) 161 | - (UIView *(^)(CGAffineTransform))cd_transform{ 162 | return ^(CGAffineTransform a) { 163 | self.transform = a; 164 | return self; 165 | }; 166 | } 167 | /// 自动调整子视图尺寸,默认YES则会根据autoresizingMask属性自动调整子视图尺寸 168 | - (UIView *(^)(BOOL))cd_autoresizesSubviews{ 169 | return ^(BOOL a) { 170 | self.autoresizesSubviews = a; 171 | return self; 172 | }; 173 | } 174 | /// 自动调整子视图与父视图的位置,默认UIViewAutoresizingNone 175 | - (UIView *(^)(UIViewAutoresizing))cd_autoresizingMask{ 176 | return ^(UIViewAutoresizing a) { 177 | self.autoresizingMask = a; 178 | return self; 179 | }; 180 | } 181 | 182 | - (UIView *(^)(UIView *))cd_addSubView{ 183 | return ^(UIView *a) { 184 | [self addSubview:a]; 185 | return self; 186 | }; 187 | } 188 | 189 | - (UIView * (^)(BOOL))cd_opaque{ 190 | return ^(BOOL a) { 191 | self.opaque = a; 192 | return self; 193 | }; 194 | } 195 | - (UIView * (^)(CGFloat))cd_alpha{ 196 | return ^(CGFloat a) { 197 | self.alpha = a; 198 | return self; 199 | }; 200 | } 201 | 202 | - (UIView * (^)(BOOL))cd_masksToBounds{ 203 | return ^(BOOL a) { 204 | self.layer.masksToBounds = a; 205 | return self; 206 | }; 207 | } 208 | 209 | - (UIView * (^)(UIEdgeInsets))cd_layoutMargins{ 210 | return ^(UIEdgeInsets a) { 211 | self.layoutMargins = a; 212 | return self; 213 | }; 214 | } 215 | 216 | - (UIView * (^)(UIGestureRecognizer *))cd_addGestureRecognizer{ 217 | return ^(UIGestureRecognizer *a) { 218 | [self addGestureRecognizer:a]; 219 | return self; 220 | }; 221 | } 222 | 223 | - (UIView * (^)(NSLayoutConstraint *))cd_addConstraint{ 224 | return ^(NSLayoutConstraint *a) { 225 | [self addConstraint:a]; 226 | return self; 227 | }; 228 | } 229 | 230 | - (UIView * (^)(NSArray<__kindof NSLayoutConstraint *> *))cd_addConstraints{ 231 | return ^(NSArray<__kindof NSLayoutConstraint *> *a) { 232 | [self addConstraints:a]; 233 | return self; 234 | }; 235 | } 236 | @end 237 | -------------------------------------------------------------------------------- /Example/CD_ObjC/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIButton+Chain.m: -------------------------------------------------------------------------------- 1 | 2 | #import "UIButton+Chain.h" 3 | 4 | @implementation UIButton (Chain) 5 | - (UIButton * (^)(NSString *))cd_title{ 6 | return ^(NSString * a){ 7 | self.cd_titleState(a,UIControlStateNormal); 8 | return self; 9 | }; 10 | } 11 | 12 | - (UIButton * (^)(NSString *, UIControlState))cd_titleState{ 13 | return ^(NSString *a, UIControlState b){ 14 | [self setTitle:a forState:b]; 15 | return self; 16 | }; 17 | } 18 | 19 | - (UIButton * (^)(UIColor *))cd_titleColor{ 20 | return ^(UIColor * a){ 21 | self.cd_titleColorState(a,UIControlStateNormal); 22 | return self; 23 | }; 24 | } 25 | 26 | - (UIButton * (^)(UIColor *, UIControlState))cd_titleColorState{ 27 | return ^(UIColor *a, UIControlState b){ 28 | [self setTitleColor:a forState:b]; 29 | return self; 30 | }; 31 | } 32 | 33 | - (UIButton * (^)(UIFont *))cd_titleFont{ 34 | return ^(UIFont *a){ 35 | self.titleLabel.font = a; 36 | return self; 37 | }; 38 | } 39 | - (UIButton * (^)(BOOL))cd_enabled{ 40 | return ^(BOOL a){ 41 | self.enabled = a; 42 | return self; 43 | }; 44 | } 45 | 46 | - (UIButton * (^)(UIImage *))cd_image{ 47 | return ^(UIImage *a){ 48 | [self setImage:a forState:UIControlStateNormal]; 49 | return self; 50 | }; 51 | } 52 | 53 | - (UIButton * (^)(UIImage *, UIControlState))cd_imageState{ 54 | return ^(UIImage *a, UIControlState b){ 55 | [self setImage:a forState:b]; 56 | return self; 57 | }; 58 | } 59 | 60 | - (UIButton * (^)(UIImage *))cd_bgImage{ 61 | return ^(UIImage *a){ 62 | [self setBackgroundImage:a forState:UIControlStateNormal]; 63 | return self; 64 | }; 65 | } 66 | 67 | - (UIButton * (^)(UIImage *, UIControlState))cd_bgImageState{ 68 | return ^(UIImage *a, UIControlState b){ 69 | [self setBackgroundImage:a forState:b]; 70 | return self; 71 | }; 72 | } 73 | 74 | - (UIButton * (^)(NSAttributedString *))cd_attributedTitle{ 75 | return ^(NSAttributedString * a){ 76 | [self setAttributedTitle:a forState:UIControlStateNormal]; 77 | return self; 78 | }; 79 | } 80 | - (UIButton * (^)(NSAttributedString *, UIControlState))cd_attributedTitleState{ 81 | return ^(NSAttributedString * a, UIControlState b){ 82 | [self setAttributedTitle:a forState:b]; 83 | return self; 84 | }; 85 | } 86 | 87 | - (UIButton * (^)(CGFloat , CGFloat, CGFloat, CGFloat))cd_titleEdgeInsets{ 88 | return ^(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right){ 89 | self.titleEdgeInsets = UIEdgeInsetsMake(top, left, bottom, right); 90 | return self; 91 | }; 92 | } 93 | 94 | - (UIButton * (^)(CGFloat , CGFloat, CGFloat, CGFloat))cd_imageEdgeInsets{ 95 | return ^(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right){ 96 | self.imageEdgeInsets = UIEdgeInsetsMake(top, left, bottom, right);; 97 | return self; 98 | }; 99 | } 100 | 101 | 102 | - (UIButton * (^)(UIControlContentHorizontalAlignment))cd_contentHorizontalAlignment{ 103 | return ^(UIControlContentHorizontalAlignment a){ 104 | self.contentHorizontalAlignment = a; 105 | return self; 106 | }; 107 | } 108 | - (UIButton * (^)(UIControlContentVerticalAlignment))cd_contentVerticalAlignment{ 109 | return ^(UIControlContentVerticalAlignment a){ 110 | self.contentVerticalAlignment = a; 111 | return self; 112 | }; 113 | } 114 | 115 | 116 | - (UIButton * (^)(BOOL))cd_reversesTitleShadowWhenHighlighted{ 117 | return ^(BOOL a){ 118 | self.reversesTitleShadowWhenHighlighted = a; 119 | return self; 120 | }; 121 | } 122 | - (UIButton * (^)(BOOL))cd_adjustsImageWhenHighlighted{ 123 | return ^(BOOL a){ 124 | self.adjustsImageWhenHighlighted = a; 125 | return self; 126 | }; 127 | } 128 | - (UIButton * (^)(BOOL))cd_adjustsImageWhenDisabled{ 129 | return ^(BOOL a){ 130 | self.adjustsImageWhenDisabled = a; 131 | return self; 132 | }; 133 | } 134 | - (UIButton * (^)(BOOL))cd_showsTouchWhenHighlighted{ 135 | return ^(BOOL a){ 136 | self.showsTouchWhenHighlighted = a; 137 | return self; 138 | }; 139 | } 140 | 141 | 142 | - (UIButton * (^)(UIColor *bg, UIActivityIndicatorViewStyle st))cd_loading{ 143 | return ^(UIColor * b, UIActivityIndicatorViewStyle s){ 144 | self.enabled = NO; 145 | UIView * v = [UIView new]; 146 | v.frame = self.bounds; 147 | v.tag = -8668; 148 | v.backgroundColor = b; 149 | [self addSubview:v]; 150 | UIActivityIndicatorView * act = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:s]; 151 | act.frame = v.bounds; 152 | [act startAnimating]; 153 | [v addSubview:act]; 154 | ///超时 155 | __weak typeof(self) weakSelf = self; 156 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 157 | __strong typeof(weakSelf) strongSelf = weakSelf; 158 | strongSelf.cd_loadingHidden(); 159 | }); 160 | return self; 161 | }; 162 | } 163 | 164 | - (UIButton * (^)(UIColor *bg, UIColor *act, UIActivityIndicatorViewStyle st, CGPoint po))cd_loadingC{ 165 | return ^(UIColor * b, UIColor *act, UIActivityIndicatorViewStyle s, CGPoint p){ 166 | self.enabled = NO; 167 | UIActivityIndicatorView * activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:s]; 168 | [activity startAnimating]; 169 | UIView * v = [UIView new]; 170 | v.center = p; 171 | v.bounds = activity.bounds; 172 | v.tag = -8668; 173 | v.backgroundColor = b; 174 | if (act) { 175 | activity.color = act; 176 | } 177 | activity.frame = v.bounds; 178 | [self addSubview:v]; 179 | [v addSubview:activity]; 180 | ///超时 181 | __weak typeof(self) weakSelf = self; 182 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 183 | __strong typeof(weakSelf) strongSelf = weakSelf; 184 | strongSelf.cd_loadingHidden(); 185 | }); 186 | return self; 187 | }; 188 | } 189 | /// 向Button上添加 Activity loading 自定义Activity 190 | - (UIButton * (^)(void (^)(void)))cd_loadingCustom{ 191 | return ^( void (^custom)(void)){ 192 | if (custom) { 193 | custom(); 194 | } 195 | return self; 196 | }; 197 | } 198 | 199 | - (UIButton * (^)(void))cd_loadingHidden{ 200 | return ^(void){ 201 | [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 202 | if (obj.tag == -8668) { 203 | [obj removeFromSuperview]; 204 | *stop = YES; 205 | } 206 | }]; 207 | self.enabled = YES; 208 | return self; 209 | }; 210 | } 211 | 212 | - (UIButton * (^)(NSInteger))cd_loadingHiddenTag{ 213 | return ^(NSInteger tag){ 214 | __block NSInteger t = tag; 215 | [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 216 | if (obj.tag == t) { 217 | [obj removeFromSuperview]; 218 | *stop = YES; 219 | } 220 | }]; 221 | self.enabled = YES; 222 | return self; 223 | }; 224 | } 225 | 226 | @end 227 | -------------------------------------------------------------------------------- /CaamDauObjC/Chain/UIAlertController+Chain.m: -------------------------------------------------------------------------------- 1 | 2 | #import "UIAlertController+Chain.h" 3 | 4 | @implementation UIAlertController (Chain) 5 | 6 | #pragma mark ----- 初始化 7 | + (UIAlertController*)cd_alert{ 8 | return [UIAlertController cd_alert:UIAlertControllerStyleAlert]; 9 | } 10 | + (UIAlertController*)cd_sheet{ 11 | return [UIAlertController cd_alert:UIAlertControllerStyleActionSheet]; 12 | } 13 | + (UIAlertController*)cd_alert:(UIAlertControllerStyle)style{ 14 | return [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:style]; 15 | } 16 | #pragma mark ----- 显示 17 | - (UIAlertController *(^)(UIViewController* ))cd_show{ 18 | return ^(UIViewController* vc){ 19 | self.cd_showBlock(vc,nil); 20 | return self; 21 | }; 22 | } 23 | - (UIAlertController *(^)(UIViewController* vc, void (^block)(void)))cd_showBlock{ 24 | return ^id(UIViewController* vc, void (^block)(void)){ 25 | if (!self.title && !self.message && self.actions.count==0) { 26 | NSLog(@"💀💀大哥!你别这样,什么东西都不放,俺会崩溃的💀💀"); 27 | return nil; 28 | } 29 | if (!vc) { 30 | NSLog(@"💀💀大哥!你别这样, 告诉我从哪里弹出来呀💀💀"); 31 | } 32 | [vc presentViewController:self animated:YES completion:block]; 33 | return self; 34 | }; 35 | } 36 | 37 | #pragma mark ----- 消失 38 | - (void (^)(void))cd_hidden{ 39 | return ^(void){ 40 | self.cd_hiddenBlock(nil); 41 | }; 42 | } 43 | - (void(^)(void (^)(void)))cd_hiddenBlock{ 44 | return ^(void (^block)(void)){ 45 | self.cd_hiddenTimeBlock(1.0,block); 46 | }; 47 | } 48 | - (void(^)(NSTimeInterval time, void (^block)(void)))cd_hiddenTimeBlock{ 49 | return ^(NSTimeInterval time,void (^block)(void)){ 50 | __weak typeof(self) weakSelf = self; 51 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 52 | __strong typeof(weakSelf) strongSelf = weakSelf; 53 | [strongSelf dismissViewControllerAnimated:YES completion:block]; 54 | }); 55 | }; 56 | 57 | } 58 | #pragma mark ----- Title 样式 59 | - (UIAlertController *(^)(NSString*))cd_title{ 60 | return ^(NSString* title){ 61 | self.title = title; 62 | return self; 63 | }; 64 | } 65 | - (UIAlertController *(^)(UIFont*))cd_titleFont{ 66 | return ^(UIFont* font){ 67 | if (self.title.length>0) { 68 | NSAttributedString * attributedMessage = [self valueForKey:@"attributedTitle"]; 69 | NSMutableAttributedString *attributedString; 70 | if (attributedMessage) { 71 | attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:attributedMessage]; 72 | }else{ 73 | attributedString = [[NSMutableAttributedString alloc] initWithString:self.title]; 74 | } 75 | [attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, attributedString.length)]; 76 | [self setValue:attributedString forKey:@"attributedTitle"]; 77 | } 78 | return self; 79 | }; 80 | } 81 | - (UIAlertController *(^)(UIColor*))cd_titleColor{ 82 | return ^(UIColor* color){ 83 | if (self.title.length>0) { 84 | NSAttributedString * attributedMessage = [self valueForKey:@"attributedTitle"]; 85 | NSMutableAttributedString *attributedString; 86 | if (attributedMessage) { 87 | attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:attributedMessage]; 88 | }else{ 89 | attributedString = [[NSMutableAttributedString alloc] initWithString:self.title]; 90 | } 91 | [attributedString addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, attributedString.length)]; 92 | [self setValue:attributedString forKey:@"attributedTitle"]; 93 | } 94 | return self; 95 | }; 96 | } 97 | - (UIAlertController *(^)(NSAttributedString*))cd_titleAttributed{ 98 | return ^(NSAttributedString* string){ 99 | [self setValue:string forKey:@"attributedTitle"]; 100 | return self; 101 | }; 102 | } 103 | #pragma mark ----- Msg 样式 104 | - (UIAlertController *(^)(NSString*))cd_message{ 105 | return ^(NSString* message){ 106 | self.message = message; 107 | return self; 108 | }; 109 | } 110 | - (UIAlertController *(^)(UIFont*))cd_messageFont{ 111 | return ^(UIFont* font){ 112 | if (self.message.length>0) { 113 | NSAttributedString * attributedMessage = [self valueForKey:@"attributedMessage"]; 114 | NSMutableAttributedString *attributedString; 115 | if (attributedMessage) { 116 | attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:attributedMessage]; 117 | }else{ 118 | attributedString = [[NSMutableAttributedString alloc] initWithString:self.message]; 119 | } 120 | [attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, attributedString.length)]; 121 | [self setValue:attributedString forKey:@"attributedMessage"]; 122 | } 123 | return self; 124 | }; 125 | } 126 | 127 | - (UIAlertController *(^)(UIColor*))cd_messageColor{ 128 | return ^(UIColor* color){ 129 | if (self.message.length>0) { 130 | NSAttributedString * attributedMessage = [self valueForKey:@"attributedMessage"]; 131 | NSMutableAttributedString *attributedString; 132 | if (attributedMessage) { 133 | attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:attributedMessage]; 134 | }else{ 135 | attributedString = [[NSMutableAttributedString alloc] initWithString:self.message]; 136 | } 137 | 138 | [attributedString addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, attributedString.length)]; 139 | [self setValue:attributedString forKey:@"attributedMessage"]; 140 | } 141 | return self; 142 | }; 143 | } 144 | - (UIAlertController *(^)(NSString*))cd_messageAttributed{ 145 | return ^(NSString* string){ 146 | [self setValue:string forKey:@"attributedMessage"]; 147 | return self; 148 | }; 149 | } 150 | #pragma mark ----- 按钮 151 | - (UIAlertController *(^)(NSString*text, void (^handler)(void)))cd_action{ 152 | return ^(NSString* t, void (^h)(void)){ 153 | UIAlertAction * action = [UIAlertAction actionWithTitle:t style:0 handler:^(UIAlertAction * _Nonnull action) { 154 | if (h) { 155 | h(); 156 | } 157 | }]; 158 | [self addAction:action]; 159 | return self; 160 | }; 161 | } 162 | 163 | - (UIAlertController *(^)(void(^custom)(UIAlertAction * action)))cd_actionCustom{ 164 | return ^(void(^custom)(UIAlertAction * action)){ 165 | UIAlertAction * action = [UIAlertAction actionWithTitle:@"" style:0 handler:nil]; 166 | if (custom) { 167 | custom(action); 168 | } 169 | [self addAction:action]; 170 | return self; 171 | }; 172 | } 173 | @end 174 | 175 | 176 | @implementation UIAlertAction (Chain) 177 | 178 | - (UIAlertAction *(^)(NSString*))cd_text{ 179 | return ^(NSString* text){ 180 | if (text) { 181 | [self setValue:text forKey:@"title"]; 182 | } 183 | return self; 184 | }; 185 | } 186 | - (UIAlertAction *(^)(UIColor*))cd_textColor{ 187 | return ^(UIColor* color){ 188 | if (color) { 189 | [self setValue:color forKey:@"titleTextColor"]; 190 | } 191 | return self; 192 | }; 193 | } 194 | 195 | - (UIAlertAction *(^)(UIAlertActionStyle))cd_style{ 196 | return ^(UIAlertActionStyle style){ 197 | [self setValue:@(style) forKey:@"style"]; 198 | return self; 199 | }; 200 | } 201 | - (UIAlertAction *(^)(void(^handler)(UIAlertAction * _Nonnull action)))cd_handler{ 202 | return ^(void(^handler)(UIAlertAction * _Nonnull action)){ 203 | [self setValue:handler forKey:@"handler"]; 204 | return self; 205 | }; 206 | } 207 | @end 208 | -------------------------------------------------------------------------------- /CaamDauObjC/Form/CD_Form.m: -------------------------------------------------------------------------------- 1 | //Created on 2020/1/3 by LCD:https://github.com/liucaide . 2 | 3 | /***** 模块文档 ***** 4 | * 5 | */ 6 | 7 | 8 | 9 | 10 | #import "CD_Form.h" 11 | #import "UITableView+CD.h" 12 | #import "UICollectionView+CD.h" 13 | @implementation CD_Form 14 | - (NSMutableArray *> *)forms { 15 | if (!_forms) { 16 | _forms = [NSMutableArray array]; 17 | } 18 | return _forms; 19 | } 20 | 21 | - (NSMutableArray *)headers { 22 | if (!_headers) { 23 | _headers = [NSMutableArray array]; 24 | } 25 | return _headers; 26 | } 27 | 28 | - (NSMutableArray *)footers { 29 | if (!_footers) { 30 | _footers = [NSMutableArray array]; 31 | } 32 | return _footers; 33 | } 34 | 35 | @end 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | @interface CD_FormDelegateDataSource() 44 | @property (nonatomic, strong, readwrite) CD_Form* form; 45 | @end 46 | @implementation CD_FormDelegateDataSource 47 | - (CD_Form *)form { 48 | if (!_form) { 49 | _form = [CD_Form new]; 50 | } 51 | return _form; 52 | } 53 | 54 | - (instancetype)initWithForm:(CD_Form*)form { 55 | self = [super init]; 56 | if (self) { 57 | self.form = form; 58 | } 59 | return self; 60 | } 61 | @end 62 | 63 | @interface CD_FormTableViewDelegateDataSource() 64 | @end 65 | 66 | @implementation CD_FormTableViewDelegateDataSource 67 | 68 | - (void)makeTableView:(__weak UITableView*)tableView { 69 | self.form.reloadData = ^{ 70 | __strong UITableView* strongTableView = tableView; 71 | [strongTableView reloadData]; 72 | }; 73 | 74 | self.form.reloadRows = ^(NSArray * _Nonnull rows, UITableViewRowAnimation animation) { 75 | __strong UITableView* strongTableView = tableView; 76 | [strongTableView reloadRowsAtIndexPaths:rows withRowAnimation:animation]; 77 | }; 78 | 79 | self.form.reloadSections = ^(NSIndexSet * _Nonnull sections, UITableViewRowAnimation animation) { 80 | __strong UITableView* strongTableView = tableView; 81 | [strongTableView reloadSections:sections withRowAnimation:animation]; 82 | }; 83 | 84 | } 85 | 86 | 87 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 88 | return self.form.forms.count; 89 | } 90 | 91 | - (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 92 | return self.form.forms[section].count; 93 | } 94 | 95 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 96 | CD_Row *row = self.form.forms[indexPath.section][indexPath.row]; 97 | return row.height; 98 | } 99 | 100 | - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { 101 | CD_Row *row = self.form.forms[indexPath.section][indexPath.row]; 102 | UITableViewCell *cell = [tableView cd_cell:row.viewClass bundleFrom:row.bundleFrom]; 103 | [row bindView:cell]; 104 | return cell; 105 | } 106 | 107 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 108 | CD_Row *row = self.form.forms[indexPath.section][indexPath.row]; 109 | if (row.didSelect) { 110 | row.didSelect(); 111 | } 112 | } 113 | 114 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 115 | if (self.form.headers.count > section) { 116 | CD_Row *row = self.form.headers[section]; 117 | return row.height; 118 | } 119 | return 0.001; 120 | } 121 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 122 | if (self.form.footers.count > section) { 123 | CD_Row *row = self.form.footers[section]; 124 | return row.height; 125 | } 126 | return 0.001; 127 | } 128 | 129 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 130 | if (self.form.headers.count > section) { 131 | CD_Row *row = self.form.headers[section]; 132 | UITableViewHeaderFooterView * view = [tableView cd_view:row.viewClass bundleFrom:row.bundleFrom]; 133 | [row bindView:view]; 134 | return view; 135 | } 136 | return nil; 137 | } 138 | 139 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 140 | if (self.form.footers.count > section) { 141 | CD_Row *row = self.form.footers[section]; 142 | UITableViewHeaderFooterView * view = [tableView cd_view:row.viewClass bundleFrom:row.bundleFrom]; 143 | [row bindView:view]; 144 | return view; 145 | } 146 | return nil; 147 | } 148 | @end 149 | 150 | 151 | @interface CD_FormCollectionViewDelegateDataSource() 152 | 153 | @end 154 | 155 | @implementation CD_FormCollectionViewDelegateDataSource 156 | 157 | - (void)makeCollectionView:(__weak UICollectionView*)collectionView { 158 | self.form.reloadData = ^{ 159 | __strong UICollectionView* strongCollectionView = collectionView; 160 | [strongCollectionView reloadData]; 161 | }; 162 | 163 | self.form.reloadRows = ^(NSArray * _Nonnull rows, UITableViewRowAnimation animation) { 164 | __strong UICollectionView* strongCollectionView = collectionView; 165 | [strongCollectionView reloadItemsAtIndexPaths:rows]; 166 | }; 167 | 168 | self.form.reloadSections = ^(NSIndexSet * _Nonnull sections, UITableViewRowAnimation animation) { 169 | __strong UICollectionView* strongCollectionView = collectionView; 170 | 171 | [strongCollectionView reloadSections:sections]; 172 | }; 173 | } 174 | 175 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { 176 | return self.form.forms.count; 177 | } 178 | - (NSInteger)collectionView:(nonnull UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 179 | return self.form.forms[section].count; 180 | } 181 | - (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath { 182 | CD_Row *row = self.form.forms[indexPath.section][indexPath.row]; 183 | UICollectionViewCell *cell = [collectionView cd_cell:row.viewClass indexPath:indexPath]; 184 | [row bindView:cell]; 185 | return cell; 186 | } 187 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { 188 | CD_Row *row = self.form.forms[indexPath.section][indexPath.row]; 189 | return row.size; 190 | } 191 | 192 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { 193 | CD_Row *row = self.form.forms[indexPath.section][indexPath.row]; 194 | if (row.didSelect) { 195 | row.didSelect(); 196 | } 197 | } 198 | 199 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { 200 | if (self.form.headers.count > section) { 201 | CD_Row *row = self.form.headers[section]; 202 | return row.size; 203 | } 204 | return CGSizeZero; 205 | } 206 | 207 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { 208 | if (self.form.footers.count > section) { 209 | CD_Row *row = self.form.footers[section]; 210 | return row.size; 211 | } 212 | return CGSizeZero; 213 | } 214 | 215 | - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { 216 | if (kind == UICollectionElementKindSectionHeader && self.form.headers.count > indexPath.section) { 217 | CD_Row *row = self.form.headers[indexPath.section]; 218 | UICollectionReusableView * view = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass(row.viewClass) forIndexPath:indexPath]; 219 | [row bindView:view]; 220 | return view; 221 | }else if (kind == UICollectionElementKindSectionFooter && self.form.footers.count > indexPath.section) { 222 | CD_Row *row = self.form.footers[indexPath.section]; 223 | UICollectionReusableView * view = [collectionView cd_view:row.viewClass indexPath:indexPath kind:kind]; 224 | [row bindView:view]; 225 | return view; 226 | }else{ 227 | return [collectionView cd_view:CD_CollectionReusableViewNone.class indexPath:indexPath kind:kind]; 228 | } 229 | } 230 | 231 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { 232 | if (self.form.headers.count > section) { 233 | CD_Row *row = self.form.headers[section]; 234 | return row.frame.origin.y; 235 | }else if (self.form.forms.count > section && self.form.forms[section].count > 0) { 236 | return self.form.forms[section].firstObject.frame.origin.y; 237 | } 238 | return 0; 239 | } 240 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { 241 | if (self.form.footers.count > section) { 242 | CD_Row *row = self.form.footers[section]; 243 | return row.frame.origin.x; 244 | }else if (self.form.forms.count > section && self.form.forms[section].count > 0) { 245 | return self.form.forms[section].firstObject.frame.origin.x; 246 | } 247 | return 0; 248 | } 249 | 250 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { 251 | if (self.form.headers.count > section) { 252 | CD_Row *row = self.form.headers[section]; 253 | return row.insets; 254 | } 255 | else if (self.form.footers.count > section) { 256 | CD_Row *row = self.form.footers[section]; 257 | return row.insets; 258 | } 259 | else if (self.form.forms.count > section && self.form.forms[section].count > 0) { 260 | return self.form.forms[section].firstObject.insets; 261 | } 262 | return UIEdgeInsetsZero; 263 | } 264 | @end 265 | 266 | 267 | @interface CD_CollectionReusableViewNone() 268 | 269 | @end 270 | 271 | @implementation CD_CollectionReusableViewNone 272 | 273 | + (NSString*)bundle { 274 | return @"CaamDauObjC"; 275 | } 276 | 277 | - (void)row_callback:(CD_RowCallback)callBack { 278 | 279 | } 280 | - (void)row_updateConfig:(id)config { 281 | 282 | } 283 | - (void)row_updateViewData:(id)data { 284 | 285 | } 286 | @end 287 | -------------------------------------------------------------------------------- /CaamDauObjC/MJRefresh/UIScrollView+CD_MJRefresh.m: -------------------------------------------------------------------------------- 1 | ///Created on 2018/3/5 by LCD :https://github.com/liucaide . 2 | 3 | #import "UIScrollView+CD_MJRefresh.h" 4 | 5 | @implementation UIScrollView (CD_MJRefresh) 6 | 7 | - (void)setCd_mjRefreshModel:(CD_MJRefreshModel *)cd_mjRefreshModel{ 8 | objc_setAssociatedObject(self, @selector(cd_mjRefreshModel), cd_mjRefreshModel, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 9 | } 10 | - (CD_MJRefreshModel *)cd_mjRefreshModel{ 11 | CD_MJRefreshModel * model = objc_getAssociatedObject(self, _cmd); 12 | if (model == nil){ 13 | model = [CD_MJRefreshModel new]; 14 | [self setCd_mjRefreshModel:model]; 15 | } 16 | return model; 17 | } 18 | 19 | #pragma mark ----- 下拉 ----- 20 | - (void)cd_headerAddMJRefresh:(MJRefreshComponentRefreshingBlock)block{ 21 | MJRefreshNormalHeader * refresh = [MJRefreshNormalHeader headerWithRefreshingBlock:block]; 22 | [self cd_header:refresh model:self.cd_mjRefreshModel]; 23 | self.mj_header = refresh; 24 | } 25 | 26 | - (void)cd_headerAddMJRefreshGif:(MJRefreshComponentRefreshingBlock)block{ 27 | MJRefreshGifHeader * refresh = [MJRefreshGifHeader headerWithRefreshingBlock:block]; 28 | [self cd_headerImages:refresh model:self.cd_mjRefreshModel]; 29 | [self cd_header:refresh model:self.cd_mjRefreshModel]; 30 | self.mj_header = refresh; 31 | } 32 | 33 | - (void)cd_headerAddMJRefresh:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block{ 34 | MJRefreshNormalHeader * refresh = [MJRefreshNormalHeader headerWithRefreshingBlock:block]; 35 | [self cd_header:refresh model:model]; 36 | self.mj_header = refresh; 37 | } 38 | 39 | - (void)cd_headerAddMJRefreshGif:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block{ 40 | MJRefreshGifHeader * refresh = [MJRefreshGifHeader headerWithRefreshingBlock:block]; 41 | [self cd_headerImages:refresh model:self.cd_mjRefreshModel]; 42 | [self cd_header:refresh model:self.cd_mjRefreshModel]; 43 | self.mj_header = refresh; 44 | } 45 | 46 | - (void)cd_headerImages:(MJRefreshGifHeader*)mj model:(CD_MJRefreshModel*)model{ 47 | [mj setImages:model.down_imgIdle forState:MJRefreshStateIdle]; 48 | [mj setImages:model.down_imgPulling forState:MJRefreshStatePulling]; 49 | [mj setImages:model.down_imgWillRefresh forState:MJRefreshStateWillRefresh]; 50 | [mj setImages:model.down_imgRefreshing forState:MJRefreshStateRefreshing]; 51 | [mj setImages:model.down_imgNoMoreData forState:MJRefreshStateNoMoreData]; 52 | } 53 | - (void)cd_header:(MJRefreshStateHeader*)mj model:(CD_MJRefreshModel*)model{ 54 | mj.stateLabel.hidden = model.down_txtHidden; 55 | mj.lastUpdatedTimeLabel.hidden = model.down_timeHidden; 56 | mj.labelLeftInset = model.down_leftInset; 57 | if (!model.down_txtHidden) { 58 | [mj setTitle:model.down_txtIdle forState:MJRefreshStateIdle]; 59 | [mj setTitle:model.down_txtPulling forState:MJRefreshStatePulling]; 60 | [mj setTitle:model.down_txtWillRefresh forState:MJRefreshStateWillRefresh]; 61 | [mj setTitle:model.down_txtRefreshing forState:MJRefreshStateRefreshing]; 62 | [mj setTitle:model.down_txtNoMoreData forState:MJRefreshStateNoMoreData]; 63 | mj.stateLabel.font = model.down_txtFont; 64 | mj.stateLabel.textColor = model.down_txtColor; 65 | } 66 | if (!model.down_timeHidden) { 67 | mj.lastUpdatedTimeLabel.font = model.down_timeFont; 68 | mj.lastUpdatedTimeLabel.textColor = model.down_timeColor; 69 | } 70 | mj.ignoredScrollViewContentInsetTop = model.ignoredContentInsetTop; 71 | } 72 | #pragma mark ----- 上拉加载 ----- 73 | - (void)cd_footerAddMJRefreshAuto:(MJRefreshComponentRefreshingBlock)block{ 74 | MJRefreshAutoNormalFooter * mj = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:block]; 75 | [self cd_footerAuto:mj model:self.cd_mjRefreshModel]; 76 | self.mj_footer = mj; 77 | } 78 | 79 | - (void)cd_footerAddMJRefreshBack:(MJRefreshComponentRefreshingBlock)block{ 80 | MJRefreshBackNormalFooter * mj = [MJRefreshBackNormalFooter footerWithRefreshingBlock:block]; 81 | [self cd_footerBack:mj model:self.cd_mjRefreshModel]; 82 | self.mj_footer = mj; 83 | } 84 | 85 | - (void)cd_footerAddMJRefreshGifAuto:(MJRefreshComponentRefreshingBlock)block{ 86 | MJRefreshAutoGifFooter * mj = [MJRefreshAutoGifFooter footerWithRefreshingBlock:block]; 87 | [self cd_footerImagesAuto:mj model:self.cd_mjRefreshModel]; 88 | [self cd_footerAuto:mj model:self.cd_mjRefreshModel]; 89 | self.mj_footer = mj; 90 | } 91 | 92 | - (void)cd_footerAddMJRefreshGifBack:(MJRefreshComponentRefreshingBlock)block{ 93 | MJRefreshBackGifFooter * mj = [MJRefreshBackGifFooter footerWithRefreshingBlock:block]; 94 | [self cd_footerImagesBack:mj model:self.cd_mjRefreshModel]; 95 | [self cd_footerBack:mj model:self.cd_mjRefreshModel]; 96 | self.mj_footer = mj; 97 | } 98 | - (void)cd_footerAddMJRefreshAuto:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block{ 99 | MJRefreshAutoNormalFooter * mj = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:block]; 100 | [self cd_footerAuto:mj model:self.cd_mjRefreshModel]; 101 | self.mj_footer = mj; 102 | } 103 | - (void)cd_footerAddMJRefreshBack:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block{ 104 | MJRefreshBackNormalFooter * mj = [MJRefreshBackNormalFooter footerWithRefreshingBlock:block]; 105 | [self cd_footerBack:mj model:model]; 106 | self.mj_footer = mj; 107 | } 108 | 109 | - (void)cd_footerAddMJRefreshGifAuto:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block{ 110 | MJRefreshAutoGifFooter * mj = [MJRefreshAutoGifFooter footerWithRefreshingBlock:block]; 111 | [self cd_footerImagesAuto:mj model:model]; 112 | [self cd_footerAuto:mj model:model]; 113 | self.mj_footer = mj; 114 | } 115 | 116 | - (void)cd_footerAddMJRefreshGifBack:(CD_MJRefreshModel*)model block:(MJRefreshComponentRefreshingBlock)block{ 117 | MJRefreshBackGifFooter * mj = [MJRefreshBackGifFooter footerWithRefreshingBlock:block]; 118 | [self cd_footerImagesBack:mj model:model]; 119 | [self cd_footerBack:mj model:model]; 120 | self.mj_footer = mj; 121 | } 122 | 123 | 124 | - (void)cd_footerImagesBack:(MJRefreshBackGifFooter*)mj model:(CD_MJRefreshModel*)model{ 125 | [mj setImages:model.up_imgIdle forState:MJRefreshStateIdle]; 126 | [mj setImages:model.up_imgPulling forState:MJRefreshStatePulling]; 127 | [mj setImages:model.up_imgWillRefresh forState:MJRefreshStateWillRefresh]; 128 | [mj setImages:model.up_imgRefreshing forState:MJRefreshStateRefreshing]; 129 | [mj setImages:model.up_imgNoMoreData forState:MJRefreshStateNoMoreData]; 130 | } 131 | - (void)cd_footerImagesAuto:(MJRefreshAutoGifFooter*)mj model:(CD_MJRefreshModel*)model{ 132 | [mj setImages:model.up_imgIdle forState:MJRefreshStateIdle]; 133 | [mj setImages:model.up_imgPulling forState:MJRefreshStatePulling]; 134 | [mj setImages:model.up_imgWillRefresh forState:MJRefreshStateWillRefresh]; 135 | [mj setImages:model.up_imgRefreshing forState:MJRefreshStateRefreshing]; 136 | [mj setImages:model.up_imgNoMoreData forState:MJRefreshStateNoMoreData]; 137 | } 138 | 139 | - (void)cd_footerBack:(MJRefreshBackStateFooter*)mj model:(CD_MJRefreshModel*)model{ 140 | 141 | mj.stateLabel.hidden = model.up_txtHidden; 142 | mj.labelLeftInset = model.up_leftInset; 143 | if (!model.up_txtHidden) { 144 | [mj setTitle:model.up_txtIdle forState:MJRefreshStateIdle]; 145 | [mj setTitle:model.up_txtPulling forState:MJRefreshStatePulling]; 146 | [mj setTitle:model.up_txtWillRefresh forState:MJRefreshStateWillRefresh]; 147 | [mj setTitle:model.up_txtRefreshing forState:MJRefreshStateRefreshing]; 148 | [mj setTitle:model.up_txtNoMoreData forState:MJRefreshStateNoMoreData]; 149 | mj.stateLabel.font = model.up_txtFont; 150 | mj.stateLabel.textColor = model.up_txtColor; 151 | } 152 | } 153 | - (void)cd_footerAuto:(MJRefreshAutoStateFooter*)mj model:(CD_MJRefreshModel*)model{ 154 | mj.refreshingTitleHidden = model.up_txtHidden; 155 | mj.stateLabel.hidden = model.up_txtHidden; 156 | mj.labelLeftInset = model.up_leftInset; 157 | if (!model.up_txtHidden) { 158 | [mj setTitle:model.up_txtIdle forState:MJRefreshStateIdle]; 159 | [mj setTitle:model.up_txtPulling forState:MJRefreshStatePulling]; 160 | [mj setTitle:model.up_txtWillRefresh forState:MJRefreshStateWillRefresh]; 161 | [mj setTitle:model.up_txtRefreshing forState:MJRefreshStateRefreshing]; 162 | [mj setTitle:model.up_txtNoMoreData forState:MJRefreshStateNoMoreData]; 163 | mj.stateLabel.font = model.up_txtFont; 164 | mj.stateLabel.textColor = model.up_txtColor; 165 | } 166 | mj.automaticallyRefresh = model.isAutoRefresh; 167 | mj.ignoredScrollViewContentInsetBottom = model.ignoredContentInsetBottom; 168 | mj.triggerAutomaticallyRefreshPercent = model.autoRefreshPercent; 169 | //mj.onlyRefreshPerDrag = model.onlyRefreshPerDrag; 170 | } 171 | 172 | 173 | 174 | #pragma mark ----- Function 其他 ----- 175 | - (void)cd_beginRefreshing{ 176 | if ([self.mj_footer isRefreshing]) { 177 | [self.mj_footer endRefreshing]; 178 | } 179 | [self.mj_header beginRefreshing]; 180 | } 181 | - (void)cd_endRefreshing{ 182 | if (self.mj_header) { 183 | [self.mj_header endRefreshing]; 184 | } 185 | if (self.mj_footer) { 186 | [self.mj_footer endRefreshing]; 187 | } 188 | } 189 | 190 | - (void)cd_endRefreshingWithNoMoreData{ 191 | if (self.mj_header) { 192 | [self.mj_header endRefreshing]; 193 | } 194 | if (self.mj_footer) { 195 | [self.mj_footer endRefreshingWithNoMoreData]; 196 | } 197 | } 198 | - (void)cd_footResetNoMoreData{ 199 | if (self.mj_footer) { 200 | [self.mj_footer resetNoMoreData]; 201 | } 202 | 203 | } 204 | - (void)cd_footHidden:(BOOL)hidden{ 205 | if (self.mj_footer) { 206 | [self.mj_footer setHidden:hidden]; 207 | } 208 | } 209 | 210 | - (void)cd_mjRefreshTypes:(NSArray*)types{ 211 | for (NSNumber* type in types) { 212 | switch ([type integerValue]) { 213 | case CD_MJRefreshTypeBegin: 214 | [self cd_beginRefreshing]; 215 | break; 216 | case CD_MJRefreshTypeEnd: 217 | [self cd_endRefreshing]; 218 | break; 219 | case CD_MJRefreshTypeNoMoreData: 220 | [self cd_endRefreshingWithNoMoreData]; 221 | break; 222 | case CD_MJRefreshTypeReset: 223 | [self cd_footResetNoMoreData]; 224 | break; 225 | case CD_MJRefreshTypeHiddenFoot: 226 | [self cd_footHidden:YES]; 227 | break; 228 | case CD_MJRefreshTypeShowFoot: 229 | [self cd_footHidden:NO]; 230 | break; 231 | default: 232 | break; 233 | } 234 | } 235 | } 236 | @end 237 | 238 | -------------------------------------------------------------------------------- /Example/CD_ObjC.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4741DDE123BED408002FD4A3 /* CaamDauObjC.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 4741DDE023BED407002FD4A3 /* CaamDauObjC.podspec */; }; 11 | 4772171323C311C300C4F676 /* Cell_Title.m in Sources */ = {isa = PBXBuildFile; fileRef = 4772171223C311C300C4F676 /* Cell_Title.m */; }; 12 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 13 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 14 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 15 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; 16 | 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; 17 | 6003F59E195388D20070C39A /* CDAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* CDAppDelegate.m */; }; 18 | 6003F5A7195388D20070C39A /* CDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* CDViewController.m */; }; 19 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; 20 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; 21 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 22 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 23 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 24 | 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; 25 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; }; 26 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; 27 | 9EE776F7526CD9BAC450ADF9 /* Pods_CD_ObjC_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42122B436075CD29C848BA8E /* Pods_CD_ObjC_Tests.framework */; }; 28 | CCFDF112689F52E46AFB8869 /* Pods_CD_ObjC_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E142F714AF4F6AA5BC3CBC36 /* Pods_CD_ObjC_Example.framework */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 6003F582195388D10070C39A /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 6003F589195388D20070C39A; 37 | remoteInfo = CD_ObjC; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 164BF9D9FF5225C06FAA0CCC /* Pods-CD_ObjC_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CD_ObjC_Tests.debug.xcconfig"; path = "Target Support Files/Pods-CD_ObjC_Tests/Pods-CD_ObjC_Tests.debug.xcconfig"; sourceTree = ""; }; 43 | 42122B436075CD29C848BA8E /* Pods_CD_ObjC_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CD_ObjC_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 44671EF14D26845971E3BF53 /* Pods-CD_ObjC_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CD_ObjC_Example.debug.xcconfig"; path = "Target Support Files/Pods-CD_ObjC_Example/Pods-CD_ObjC_Example.debug.xcconfig"; sourceTree = ""; }; 45 | 4741DDE023BED407002FD4A3 /* CaamDauObjC.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CaamDauObjC.podspec; path = ../CaamDauObjC.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 46 | 4772171123C311C300C4F676 /* Cell_Title.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Cell_Title.h; sourceTree = ""; }; 47 | 4772171223C311C300C4F676 /* Cell_Title.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Cell_Title.m; sourceTree = ""; }; 48 | 6003F58A195388D20070C39A /* CD_ObjC_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CD_ObjC_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 50 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 51 | 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 52 | 6003F595195388D20070C39A /* CD_ObjC-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CD_ObjC-Info.plist"; sourceTree = ""; }; 53 | 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 54 | 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 55 | 6003F59B195388D20070C39A /* CD_ObjC-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CD_ObjC-Prefix.pch"; sourceTree = ""; }; 56 | 6003F59C195388D20070C39A /* CDAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDAppDelegate.h; sourceTree = ""; }; 57 | 6003F59D195388D20070C39A /* CDAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CDAppDelegate.m; sourceTree = ""; }; 58 | 6003F5A5195388D20070C39A /* CDViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDViewController.h; sourceTree = ""; }; 59 | 6003F5A6195388D20070C39A /* CDViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CDViewController.m; sourceTree = ""; }; 60 | 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 61 | 6003F5AE195388D20070C39A /* CD_ObjC_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CD_ObjC_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 63 | 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; 64 | 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 65 | 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; 66 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; 67 | 71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 68 | 79355857A179407CC3EFEB56 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 69 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 70 | 9837E29A7FF72E5CE8CB1338 /* Pods-CD_ObjC_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CD_ObjC_Tests.release.xcconfig"; path = "Target Support Files/Pods-CD_ObjC_Tests/Pods-CD_ObjC_Tests.release.xcconfig"; sourceTree = ""; }; 71 | A92C03277F9E875C46AA947E /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 72 | D08134D6E6FA7B33777C82ED /* Pods-CD_ObjC_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CD_ObjC_Example.release.xcconfig"; path = "Target Support Files/Pods-CD_ObjC_Example/Pods-CD_ObjC_Example.release.xcconfig"; sourceTree = ""; }; 73 | E142F714AF4F6AA5BC3CBC36 /* Pods_CD_ObjC_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CD_ObjC_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | /* End PBXFileReference section */ 75 | 76 | /* Begin PBXFrameworksBuildPhase section */ 77 | 6003F587195388D20070C39A /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, 82 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, 83 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, 84 | CCFDF112689F52E46AFB8869 /* Pods_CD_ObjC_Example.framework in Frameworks */, 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | 6003F5AB195388D20070C39A /* Frameworks */ = { 89 | isa = PBXFrameworksBuildPhase; 90 | buildActionMask = 2147483647; 91 | files = ( 92 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, 93 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, 94 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, 95 | 9EE776F7526CD9BAC450ADF9 /* Pods_CD_ObjC_Tests.framework in Frameworks */, 96 | ); 97 | runOnlyForDeploymentPostprocessing = 0; 98 | }; 99 | /* End PBXFrameworksBuildPhase section */ 100 | 101 | /* Begin PBXGroup section */ 102 | 6003F581195388D10070C39A = { 103 | isa = PBXGroup; 104 | children = ( 105 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, 106 | 6003F593195388D20070C39A /* Example for CD_ObjC */, 107 | 6003F5B5195388D20070C39A /* Tests */, 108 | 6003F58C195388D20070C39A /* Frameworks */, 109 | 6003F58B195388D20070C39A /* Products */, 110 | 79ABEC675EF887524E6B7A86 /* Pods */, 111 | ); 112 | sourceTree = ""; 113 | }; 114 | 6003F58B195388D20070C39A /* Products */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 6003F58A195388D20070C39A /* CD_ObjC_Example.app */, 118 | 6003F5AE195388D20070C39A /* CD_ObjC_Tests.xctest */, 119 | ); 120 | name = Products; 121 | sourceTree = ""; 122 | }; 123 | 6003F58C195388D20070C39A /* Frameworks */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 6003F58D195388D20070C39A /* Foundation.framework */, 127 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, 128 | 6003F591195388D20070C39A /* UIKit.framework */, 129 | 6003F5AF195388D20070C39A /* XCTest.framework */, 130 | E142F714AF4F6AA5BC3CBC36 /* Pods_CD_ObjC_Example.framework */, 131 | 42122B436075CD29C848BA8E /* Pods_CD_ObjC_Tests.framework */, 132 | ); 133 | name = Frameworks; 134 | sourceTree = ""; 135 | }; 136 | 6003F593195388D20070C39A /* Example for CD_ObjC */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 6003F59C195388D20070C39A /* CDAppDelegate.h */, 140 | 6003F59D195388D20070C39A /* CDAppDelegate.m */, 141 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 142 | 6003F5A5195388D20070C39A /* CDViewController.h */, 143 | 6003F5A6195388D20070C39A /* CDViewController.m */, 144 | 4772171123C311C300C4F676 /* Cell_Title.h */, 145 | 4772171223C311C300C4F676 /* Cell_Title.m */, 146 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, 147 | 6003F5A8195388D20070C39A /* Images.xcassets */, 148 | 6003F594195388D20070C39A /* Supporting Files */, 149 | ); 150 | name = "Example for CD_ObjC"; 151 | path = CD_ObjC; 152 | sourceTree = ""; 153 | }; 154 | 6003F594195388D20070C39A /* Supporting Files */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 6003F595195388D20070C39A /* CD_ObjC-Info.plist */, 158 | 6003F596195388D20070C39A /* InfoPlist.strings */, 159 | 6003F599195388D20070C39A /* main.m */, 160 | 6003F59B195388D20070C39A /* CD_ObjC-Prefix.pch */, 161 | ); 162 | name = "Supporting Files"; 163 | sourceTree = ""; 164 | }; 165 | 6003F5B5195388D20070C39A /* Tests */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | 6003F5BB195388D20070C39A /* Tests.m */, 169 | 6003F5B6195388D20070C39A /* Supporting Files */, 170 | ); 171 | path = Tests; 172 | sourceTree = ""; 173 | }; 174 | 6003F5B6195388D20070C39A /* Supporting Files */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 6003F5B7195388D20070C39A /* Tests-Info.plist */, 178 | 6003F5B8195388D20070C39A /* InfoPlist.strings */, 179 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, 180 | ); 181 | name = "Supporting Files"; 182 | sourceTree = ""; 183 | }; 184 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 4741DDE023BED407002FD4A3 /* CaamDauObjC.podspec */, 188 | A92C03277F9E875C46AA947E /* README.md */, 189 | 79355857A179407CC3EFEB56 /* LICENSE */, 190 | ); 191 | name = "Podspec Metadata"; 192 | sourceTree = ""; 193 | }; 194 | 79ABEC675EF887524E6B7A86 /* Pods */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | 44671EF14D26845971E3BF53 /* Pods-CD_ObjC_Example.debug.xcconfig */, 198 | D08134D6E6FA7B33777C82ED /* Pods-CD_ObjC_Example.release.xcconfig */, 199 | 164BF9D9FF5225C06FAA0CCC /* Pods-CD_ObjC_Tests.debug.xcconfig */, 200 | 9837E29A7FF72E5CE8CB1338 /* Pods-CD_ObjC_Tests.release.xcconfig */, 201 | ); 202 | path = Pods; 203 | sourceTree = ""; 204 | }; 205 | /* End PBXGroup section */ 206 | 207 | /* Begin PBXNativeTarget section */ 208 | 6003F589195388D20070C39A /* CD_ObjC_Example */ = { 209 | isa = PBXNativeTarget; 210 | buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CD_ObjC_Example" */; 211 | buildPhases = ( 212 | EA5B9BCFBBA2A05BB0CE746F /* [CP] Check Pods Manifest.lock */, 213 | 6003F586195388D20070C39A /* Sources */, 214 | 6003F587195388D20070C39A /* Frameworks */, 215 | 6003F588195388D20070C39A /* Resources */, 216 | FA54AE46832E6C83D41AE644 /* [CP] Embed Pods Frameworks */, 217 | ); 218 | buildRules = ( 219 | ); 220 | dependencies = ( 221 | ); 222 | name = CD_ObjC_Example; 223 | productName = CD_ObjC; 224 | productReference = 6003F58A195388D20070C39A /* CD_ObjC_Example.app */; 225 | productType = "com.apple.product-type.application"; 226 | }; 227 | 6003F5AD195388D20070C39A /* CD_ObjC_Tests */ = { 228 | isa = PBXNativeTarget; 229 | buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CD_ObjC_Tests" */; 230 | buildPhases = ( 231 | 592019A9E50AA40CFFCC43EF /* [CP] Check Pods Manifest.lock */, 232 | 6003F5AA195388D20070C39A /* Sources */, 233 | 6003F5AB195388D20070C39A /* Frameworks */, 234 | 6003F5AC195388D20070C39A /* Resources */, 235 | 46D91F7CA29F2D18ABD04B56 /* [CP] Embed Pods Frameworks */, 236 | ); 237 | buildRules = ( 238 | ); 239 | dependencies = ( 240 | 6003F5B4195388D20070C39A /* PBXTargetDependency */, 241 | ); 242 | name = CD_ObjC_Tests; 243 | productName = CD_ObjCTests; 244 | productReference = 6003F5AE195388D20070C39A /* CD_ObjC_Tests.xctest */; 245 | productType = "com.apple.product-type.bundle.unit-test"; 246 | }; 247 | /* End PBXNativeTarget section */ 248 | 249 | /* Begin PBXProject section */ 250 | 6003F582195388D10070C39A /* Project object */ = { 251 | isa = PBXProject; 252 | attributes = { 253 | CLASSPREFIX = CD; 254 | LastUpgradeCheck = 0720; 255 | ORGANIZATIONNAME = "LCD-sifenzi"; 256 | TargetAttributes = { 257 | 6003F5AD195388D20070C39A = { 258 | TestTargetID = 6003F589195388D20070C39A; 259 | }; 260 | }; 261 | }; 262 | buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "CD_ObjC" */; 263 | compatibilityVersion = "Xcode 3.2"; 264 | developmentRegion = English; 265 | hasScannedForEncodings = 0; 266 | knownRegions = ( 267 | English, 268 | en, 269 | Base, 270 | ); 271 | mainGroup = 6003F581195388D10070C39A; 272 | productRefGroup = 6003F58B195388D20070C39A /* Products */; 273 | projectDirPath = ""; 274 | projectRoot = ""; 275 | targets = ( 276 | 6003F589195388D20070C39A /* CD_ObjC_Example */, 277 | 6003F5AD195388D20070C39A /* CD_ObjC_Tests */, 278 | ); 279 | }; 280 | /* End PBXProject section */ 281 | 282 | /* Begin PBXResourcesBuildPhase section */ 283 | 6003F588195388D20070C39A /* Resources */ = { 284 | isa = PBXResourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */, 288 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */, 289 | 4741DDE123BED408002FD4A3 /* CaamDauObjC.podspec in Resources */, 290 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, 291 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, 292 | ); 293 | runOnlyForDeploymentPostprocessing = 0; 294 | }; 295 | 6003F5AC195388D20070C39A /* Resources */ = { 296 | isa = PBXResourcesBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | /* End PBXResourcesBuildPhase section */ 304 | 305 | /* Begin PBXShellScriptBuildPhase section */ 306 | 46D91F7CA29F2D18ABD04B56 /* [CP] Embed Pods Frameworks */ = { 307 | isa = PBXShellScriptBuildPhase; 308 | buildActionMask = 2147483647; 309 | files = ( 310 | ); 311 | inputPaths = ( 312 | "${PODS_ROOT}/Target Support Files/Pods-CD_ObjC_Tests/Pods-CD_ObjC_Tests-frameworks.sh", 313 | "${BUILT_PRODUCTS_DIR}/Kiwi/Kiwi.framework", 314 | ); 315 | name = "[CP] Embed Pods Frameworks"; 316 | outputPaths = ( 317 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kiwi.framework", 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | shellPath = /bin/sh; 321 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CD_ObjC_Tests/Pods-CD_ObjC_Tests-frameworks.sh\"\n"; 322 | showEnvVarsInLog = 0; 323 | }; 324 | 592019A9E50AA40CFFCC43EF /* [CP] Check Pods Manifest.lock */ = { 325 | isa = PBXShellScriptBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | ); 329 | inputFileListPaths = ( 330 | ); 331 | inputPaths = ( 332 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 333 | "${PODS_ROOT}/Manifest.lock", 334 | ); 335 | name = "[CP] Check Pods Manifest.lock"; 336 | outputFileListPaths = ( 337 | ); 338 | outputPaths = ( 339 | "$(DERIVED_FILE_DIR)/Pods-CD_ObjC_Tests-checkManifestLockResult.txt", 340 | ); 341 | runOnlyForDeploymentPostprocessing = 0; 342 | shellPath = /bin/sh; 343 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 344 | showEnvVarsInLog = 0; 345 | }; 346 | EA5B9BCFBBA2A05BB0CE746F /* [CP] Check Pods Manifest.lock */ = { 347 | isa = PBXShellScriptBuildPhase; 348 | buildActionMask = 2147483647; 349 | files = ( 350 | ); 351 | inputFileListPaths = ( 352 | ); 353 | inputPaths = ( 354 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 355 | "${PODS_ROOT}/Manifest.lock", 356 | ); 357 | name = "[CP] Check Pods Manifest.lock"; 358 | outputFileListPaths = ( 359 | ); 360 | outputPaths = ( 361 | "$(DERIVED_FILE_DIR)/Pods-CD_ObjC_Example-checkManifestLockResult.txt", 362 | ); 363 | runOnlyForDeploymentPostprocessing = 0; 364 | shellPath = /bin/sh; 365 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 366 | showEnvVarsInLog = 0; 367 | }; 368 | FA54AE46832E6C83D41AE644 /* [CP] Embed Pods Frameworks */ = { 369 | isa = PBXShellScriptBuildPhase; 370 | buildActionMask = 2147483647; 371 | files = ( 372 | ); 373 | inputPaths = ( 374 | "${PODS_ROOT}/Target Support Files/Pods-CD_ObjC_Example/Pods-CD_ObjC_Example-frameworks.sh", 375 | "${BUILT_PRODUCTS_DIR}/CaamDauObjC/CaamDauObjC.framework", 376 | "${BUILT_PRODUCTS_DIR}/Home/Home.framework", 377 | "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework", 378 | ); 379 | name = "[CP] Embed Pods Frameworks"; 380 | outputPaths = ( 381 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CaamDauObjC.framework", 382 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Home.framework", 383 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework", 384 | ); 385 | runOnlyForDeploymentPostprocessing = 0; 386 | shellPath = /bin/sh; 387 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CD_ObjC_Example/Pods-CD_ObjC_Example-frameworks.sh\"\n"; 388 | showEnvVarsInLog = 0; 389 | }; 390 | /* End PBXShellScriptBuildPhase section */ 391 | 392 | /* Begin PBXSourcesBuildPhase section */ 393 | 6003F586195388D20070C39A /* Sources */ = { 394 | isa = PBXSourcesBuildPhase; 395 | buildActionMask = 2147483647; 396 | files = ( 397 | 4772171323C311C300C4F676 /* Cell_Title.m in Sources */, 398 | 6003F59E195388D20070C39A /* CDAppDelegate.m in Sources */, 399 | 6003F5A7195388D20070C39A /* CDViewController.m in Sources */, 400 | 6003F59A195388D20070C39A /* main.m in Sources */, 401 | ); 402 | runOnlyForDeploymentPostprocessing = 0; 403 | }; 404 | 6003F5AA195388D20070C39A /* Sources */ = { 405 | isa = PBXSourcesBuildPhase; 406 | buildActionMask = 2147483647; 407 | files = ( 408 | 6003F5BC195388D20070C39A /* Tests.m in Sources */, 409 | ); 410 | runOnlyForDeploymentPostprocessing = 0; 411 | }; 412 | /* End PBXSourcesBuildPhase section */ 413 | 414 | /* Begin PBXTargetDependency section */ 415 | 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { 416 | isa = PBXTargetDependency; 417 | target = 6003F589195388D20070C39A /* CD_ObjC_Example */; 418 | targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; 419 | }; 420 | /* End PBXTargetDependency section */ 421 | 422 | /* Begin PBXVariantGroup section */ 423 | 6003F596195388D20070C39A /* InfoPlist.strings */ = { 424 | isa = PBXVariantGroup; 425 | children = ( 426 | 6003F597195388D20070C39A /* en */, 427 | ); 428 | name = InfoPlist.strings; 429 | sourceTree = ""; 430 | }; 431 | 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { 432 | isa = PBXVariantGroup; 433 | children = ( 434 | 6003F5B9195388D20070C39A /* en */, 435 | ); 436 | name = InfoPlist.strings; 437 | sourceTree = ""; 438 | }; 439 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */ = { 440 | isa = PBXVariantGroup; 441 | children = ( 442 | 71719F9E1E33DC2100824A3D /* Base */, 443 | ); 444 | name = LaunchScreen.storyboard; 445 | sourceTree = ""; 446 | }; 447 | /* End PBXVariantGroup section */ 448 | 449 | /* Begin XCBuildConfiguration section */ 450 | 6003F5BD195388D20070C39A /* Debug */ = { 451 | isa = XCBuildConfiguration; 452 | buildSettings = { 453 | ALWAYS_SEARCH_USER_PATHS = NO; 454 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 455 | CLANG_CXX_LIBRARY = "libc++"; 456 | CLANG_ENABLE_MODULES = YES; 457 | CLANG_ENABLE_OBJC_ARC = YES; 458 | CLANG_WARN_BOOL_CONVERSION = YES; 459 | CLANG_WARN_CONSTANT_CONVERSION = YES; 460 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 461 | CLANG_WARN_EMPTY_BODY = YES; 462 | CLANG_WARN_ENUM_CONVERSION = YES; 463 | CLANG_WARN_INT_CONVERSION = YES; 464 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 465 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 466 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 467 | COPY_PHASE_STRIP = NO; 468 | ENABLE_TESTABILITY = YES; 469 | GCC_C_LANGUAGE_STANDARD = gnu99; 470 | GCC_DYNAMIC_NO_PIC = NO; 471 | GCC_OPTIMIZATION_LEVEL = 0; 472 | GCC_PREPROCESSOR_DEFINITIONS = ( 473 | "DEBUG=1", 474 | "$(inherited)", 475 | ); 476 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 477 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 478 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 479 | GCC_WARN_UNDECLARED_SELECTOR = YES; 480 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 481 | GCC_WARN_UNUSED_FUNCTION = YES; 482 | GCC_WARN_UNUSED_VARIABLE = YES; 483 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 484 | ONLY_ACTIVE_ARCH = YES; 485 | SDKROOT = iphoneos; 486 | TARGETED_DEVICE_FAMILY = "1,2"; 487 | }; 488 | name = Debug; 489 | }; 490 | 6003F5BE195388D20070C39A /* Release */ = { 491 | isa = XCBuildConfiguration; 492 | buildSettings = { 493 | ALWAYS_SEARCH_USER_PATHS = NO; 494 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 495 | CLANG_CXX_LIBRARY = "libc++"; 496 | CLANG_ENABLE_MODULES = YES; 497 | CLANG_ENABLE_OBJC_ARC = YES; 498 | CLANG_WARN_BOOL_CONVERSION = YES; 499 | CLANG_WARN_CONSTANT_CONVERSION = YES; 500 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 501 | CLANG_WARN_EMPTY_BODY = YES; 502 | CLANG_WARN_ENUM_CONVERSION = YES; 503 | CLANG_WARN_INT_CONVERSION = YES; 504 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 505 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 506 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 507 | COPY_PHASE_STRIP = YES; 508 | ENABLE_NS_ASSERTIONS = NO; 509 | GCC_C_LANGUAGE_STANDARD = gnu99; 510 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 511 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 512 | GCC_WARN_UNDECLARED_SELECTOR = YES; 513 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 514 | GCC_WARN_UNUSED_FUNCTION = YES; 515 | GCC_WARN_UNUSED_VARIABLE = YES; 516 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 517 | SDKROOT = iphoneos; 518 | TARGETED_DEVICE_FAMILY = "1,2"; 519 | VALIDATE_PRODUCT = YES; 520 | }; 521 | name = Release; 522 | }; 523 | 6003F5C0195388D20070C39A /* Debug */ = { 524 | isa = XCBuildConfiguration; 525 | baseConfigurationReference = 44671EF14D26845971E3BF53 /* Pods-CD_ObjC_Example.debug.xcconfig */; 526 | buildSettings = { 527 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 528 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 529 | GCC_PREFIX_HEADER = "CD_ObjC/CD_ObjC-Prefix.pch"; 530 | INFOPLIST_FILE = "CD_ObjC/CD_ObjC-Info.plist"; 531 | MODULE_NAME = ExampleApp; 532 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | TARGETED_DEVICE_FAMILY = 1; 535 | WRAPPER_EXTENSION = app; 536 | }; 537 | name = Debug; 538 | }; 539 | 6003F5C1195388D20070C39A /* Release */ = { 540 | isa = XCBuildConfiguration; 541 | baseConfigurationReference = D08134D6E6FA7B33777C82ED /* Pods-CD_ObjC_Example.release.xcconfig */; 542 | buildSettings = { 543 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 544 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 545 | GCC_PREFIX_HEADER = "CD_ObjC/CD_ObjC-Prefix.pch"; 546 | INFOPLIST_FILE = "CD_ObjC/CD_ObjC-Info.plist"; 547 | MODULE_NAME = ExampleApp; 548 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 549 | PRODUCT_NAME = "$(TARGET_NAME)"; 550 | TARGETED_DEVICE_FAMILY = 1; 551 | WRAPPER_EXTENSION = app; 552 | }; 553 | name = Release; 554 | }; 555 | 6003F5C3195388D20070C39A /* Debug */ = { 556 | isa = XCBuildConfiguration; 557 | baseConfigurationReference = 164BF9D9FF5225C06FAA0CCC /* Pods-CD_ObjC_Tests.debug.xcconfig */; 558 | buildSettings = { 559 | BUNDLE_LOADER = "$(TEST_HOST)"; 560 | FRAMEWORK_SEARCH_PATHS = ( 561 | "$(SDKROOT)/Developer/Library/Frameworks", 562 | "$(inherited)", 563 | "$(DEVELOPER_FRAMEWORKS_DIR)", 564 | ); 565 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 566 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 567 | GCC_PREPROCESSOR_DEFINITIONS = ( 568 | "DEBUG=1", 569 | "$(inherited)", 570 | ); 571 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 572 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 573 | PRODUCT_NAME = "$(TARGET_NAME)"; 574 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CD_ObjC_Example.app/CD_ObjC_Example"; 575 | WRAPPER_EXTENSION = xctest; 576 | }; 577 | name = Debug; 578 | }; 579 | 6003F5C4195388D20070C39A /* Release */ = { 580 | isa = XCBuildConfiguration; 581 | baseConfigurationReference = 9837E29A7FF72E5CE8CB1338 /* Pods-CD_ObjC_Tests.release.xcconfig */; 582 | buildSettings = { 583 | BUNDLE_LOADER = "$(TEST_HOST)"; 584 | FRAMEWORK_SEARCH_PATHS = ( 585 | "$(SDKROOT)/Developer/Library/Frameworks", 586 | "$(inherited)", 587 | "$(DEVELOPER_FRAMEWORKS_DIR)", 588 | ); 589 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 590 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 591 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 592 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 593 | PRODUCT_NAME = "$(TARGET_NAME)"; 594 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CD_ObjC_Example.app/CD_ObjC_Example"; 595 | WRAPPER_EXTENSION = xctest; 596 | }; 597 | name = Release; 598 | }; 599 | /* End XCBuildConfiguration section */ 600 | 601 | /* Begin XCConfigurationList section */ 602 | 6003F585195388D10070C39A /* Build configuration list for PBXProject "CD_ObjC" */ = { 603 | isa = XCConfigurationList; 604 | buildConfigurations = ( 605 | 6003F5BD195388D20070C39A /* Debug */, 606 | 6003F5BE195388D20070C39A /* Release */, 607 | ); 608 | defaultConfigurationIsVisible = 0; 609 | defaultConfigurationName = Release; 610 | }; 611 | 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CD_ObjC_Example" */ = { 612 | isa = XCConfigurationList; 613 | buildConfigurations = ( 614 | 6003F5C0195388D20070C39A /* Debug */, 615 | 6003F5C1195388D20070C39A /* Release */, 616 | ); 617 | defaultConfigurationIsVisible = 0; 618 | defaultConfigurationName = Release; 619 | }; 620 | 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CD_ObjC_Tests" */ = { 621 | isa = XCConfigurationList; 622 | buildConfigurations = ( 623 | 6003F5C3195388D20070C39A /* Debug */, 624 | 6003F5C4195388D20070C39A /* Release */, 625 | ); 626 | defaultConfigurationIsVisible = 0; 627 | defaultConfigurationName = Release; 628 | }; 629 | /* End XCConfigurationList section */ 630 | }; 631 | rootObject = 6003F582195388D10070C39A /* Project object */; 632 | } 633 | --------------------------------------------------------------------------------