├── 6pssss.gif
├── CustomerCollectionView
├── CustomerCollectionView.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── project.pbxproj
├── CustomerCollectionView
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Info.plist
│ ├── WHCWaterFlowLayout
│ │ ├── WHCWaterfallFlowLayout.h
│ │ └── WHCWaterfallFlowLayout.m
│ ├── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
│ ├── AppDelegate.m
│ └── ViewController.m
├── CustomerCollectionViewTests
│ ├── Info.plist
│ └── CustomerCollectionViewTests.m
└── CustomerCollectionViewUITests
│ ├── Info.plist
│ └── CustomerCollectionViewUITests.m
├── README.md
└── .gitignore
/6pssss.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Wanghongchao12138/CustomerCollectionView/HEAD/6pssss.gif
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // CustomerCollectionView
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // CustomerCollectionView
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // CustomerCollectionView
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionViewTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionViewUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CustomerCollectionView
2 | 自定义瀑布流(可添加自定义header和footer)
3 |
4 | 
5 |
6 | /*
7 | 设置cell 的宽高
8 | */
9 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(WHCWaterfallFlowLayout*)collectionViewLayout heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath*)indexPath;
10 |
11 | /*
12 | 设置collection 的头视图的size
13 | */
14 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(WHCWaterfallFlowLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;
15 |
16 | /*
17 | 设置collection footer 视图的size
18 | */
19 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(WHCWaterfallFlowLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section;
20 |
21 | -- colCount -- 设置CollectionView 的cell 的列数
22 | -- sectionInset -- 设置cell 的间距
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionViewTests/CustomerCollectionViewTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // CustomerCollectionViewTests.m
3 | // CustomerCollectionViewTests
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CustomerCollectionViewTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation CustomerCollectionViewTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionViewUITests/CustomerCollectionViewUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // CustomerCollectionViewUITests.m
3 | // CustomerCollectionViewUITests
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CustomerCollectionViewUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation CustomerCollectionViewUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xccheckout
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 | *.dSYM.zip
29 | *.dSYM
30 |
31 | # CocoaPods
32 | #
33 | # We recommend against adding the Pods directory to your .gitignore. However
34 | # you should judge for yourself, the pros and cons are mentioned at:
35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
36 | #
37 | # Pods/
38 |
39 | # Carthage
40 | #
41 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
42 | # Carthage/Checkouts
43 |
44 | Carthage/Build
45 |
46 | # fastlane
47 | #
48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
49 | # screenshots whenever they are needed.
50 | # For more information about the recommended setup visit:
51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
52 |
53 | fastlane/report.xml
54 | fastlane/Preview.html
55 | fastlane/screenshots
56 | fastlane/test_output
57 |
58 | # Code Injection
59 | #
60 | # After new code Injection tools there's a generated folder /iOSInjectionProject
61 | # https://github.com/johnno1962/injectionforxcode
62 |
63 | iOSInjectionProject/
64 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/WHCWaterFlowLayout/WHCWaterfallFlowLayout.h:
--------------------------------------------------------------------------------
1 | //
2 | // WHCWaterfallFlowLayout.h
3 | // CustomCollection
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import
10 | UIKIT_EXTERN NSString *const UICollectionElementKindSectionHeader;
11 | UIKIT_EXTERN NSString *const UICollectionElementKindSectionFooter;
12 |
13 | @class WHCWaterfallFlowLayout;
14 | @protocol WHCWaterfallFlowLayoutDelegate
15 | @required
16 | /*
17 | item heigh 设置第一个cell 的宽高
18 | */
19 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(WHCWaterfallFlowLayout*)collectionViewLayout heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath*)indexPath;
20 |
21 | @optional
22 | /*
23 | 设置collection 的头视图的size
24 | */
25 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(WHCWaterfallFlowLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;
26 | /*
27 | section footer 设置collection footer 视图的size
28 | */
29 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(WHCWaterfallFlowLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section;
30 | @end
31 |
32 | @interface WHCWaterfallFlowLayout : UICollectionViewLayout
33 |
34 | @property(nonatomic, assign)UIEdgeInsets sectionInset; //cell 间距
35 | @property(nonatomic, assign)CGFloat lineSpacing; //line space
36 | @property(nonatomic, assign)CGFloat itemSpacing; //item space
37 | @property(nonatomic, assign)CGFloat colCount; //设置colleciton 的列数
38 | @property(nonatomic, weak)id delegate;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/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 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/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 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // CustomerCollectionView
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // 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.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // 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.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // 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.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // CustomCollection
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "WHCWaterfallFlowLayout.h"
11 | #define HOME_SCREEN_SIZE [UIScreen mainScreen].bounds.size
12 | #define HOME_SCREEN_WIDTH HOME_SCREEN_SIZE.width
13 | #define HOME_SCREEN_HEIGHT HOME_SCREEN_SIZE.height
14 |
15 | @interface ViewController ()
16 | @property (nonatomic , strong)UICollectionView *collectionView;
17 | @end
18 |
19 | @implementation ViewController
20 |
21 | - (void)viewDidLoad {
22 | [super viewDidLoad];
23 |
24 | WHCWaterfallFlowLayout *whcLayout = [[WHCWaterfallFlowLayout alloc] init];
25 | whcLayout.itemSpacing = 10;
26 | whcLayout.lineSpacing = 10;
27 | whcLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
28 | whcLayout.colCount = 2;
29 | whcLayout.delegate = self;
30 |
31 | _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, HOME_SCREEN_WIDTH, HOME_SCREEN_HEIGHT) collectionViewLayout:whcLayout];
32 | _collectionView.delegate = self;
33 | _collectionView.dataSource = self;
34 | _collectionView.showsVerticalScrollIndicator = NO;
35 | _collectionView.showsHorizontalScrollIndicator = NO;
36 | [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"UICollectionViewCell"];
37 |
38 | // [_collectionView addSubview: self.tipLabel];
39 | [self.view addSubview:_collectionView];
40 | self.collectionView.alwaysBounceVertical = YES;
41 | }
42 | #pragma mark collectionViewDatasouce
43 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
44 | // return self.viewModel.dataArray.count;
45 | return 1;
46 | }
47 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
48 | {
49 | return 20;
50 | }
51 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
52 | {
53 | NSLog(@"当前点击的是第%ld个cell",(long)indexPath.item);
54 | }
55 |
56 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
57 | {
58 |
59 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"UICollectionViewCell" forIndexPath:indexPath];
60 | for (id imageView in cell.subviews) {
61 | [imageView removeFromSuperview];
62 | }
63 | //随机颜色
64 | cell.backgroundColor = [UIColor colorWithRed:arc4random_uniform(255) / 255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1];
65 | UILabel *lable = [[UILabel alloc]initWithFrame:cell.bounds];
66 | lable.textAlignment = NSTextAlignmentCenter;
67 | lable.text = [NSString stringWithFormat:@"%ld",indexPath.item];
68 | [cell addSubview:lable];
69 | return cell;
70 | }
71 |
72 | - (void)didReceiveMemoryWarning {
73 | [super didReceiveMemoryWarning];
74 | // Dispose of any resources that can be recreated.
75 | }
76 |
77 | #pragma mark WHCWaterfallFlowLayout
78 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(WHCWaterfallFlowLayout*)collectionViewLayout heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath*)indexPath
79 | {
80 | //这个位置可以设置cell 的宽高 例:设置第一个cell的宽高
81 | CGFloat W = (HOME_SCREEN_WIDTH - 10) / 2;
82 | if (indexPath.section == 0) {
83 | if (indexPath.row == 0) {
84 | return 100/W*width;
85 | }else
86 | {
87 | return (W + 50)/W*width;
88 | }
89 | }
90 | else
91 | {
92 | return 0;
93 | }
94 | }
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView/WHCWaterFlowLayout/WHCWaterfallFlowLayout.m:
--------------------------------------------------------------------------------
1 | //
2 | // WHCWaterfallFlowLayout.m
3 | // CustomCollection
4 | //
5 | // Created by WHC on 2017/7/31.
6 | // Copyright © 2017年 Wang. All rights reserved.
7 | //
8 |
9 | #import "WHCWaterfallFlowLayout.h"
10 |
11 | /* 默认值 */
12 | static const CGFloat inset = 10;
13 | static const CGFloat colCount = 3;
14 |
15 | @interface WHCWaterfallFlowLayout ()
16 | @property (nonatomic, strong) NSMutableDictionary *colunMaxYDic;
17 | @end
18 | @implementation WHCWaterfallFlowLayout
19 | - (instancetype)init
20 | {
21 | if (self=[super init]) {
22 | self.itemSpacing = inset;
23 | self.lineSpacing = inset;
24 | self.sectionInset = UIEdgeInsetsMake(inset, inset, inset, inset);
25 | self.colCount = colCount;
26 | self.colunMaxYDic = [[NSMutableDictionary alloc] init];
27 | }
28 | return self;
29 | }
30 |
31 | - (void)prepareLayout
32 | {
33 | [super prepareLayout];
34 | }
35 |
36 | - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
37 | {
38 | return YES;
39 | }
40 |
41 | - (CGSize)collectionViewContentSize
42 | {
43 | __block NSString * maxCol = @"0";
44 | //遍历找出最高的列
45 | [self.colunMaxYDic enumerateKeysAndObjectsUsingBlock:^(NSString * column, NSNumber *maxY, BOOL *stop) {
46 | if ([maxY floatValue] > [self.colunMaxYDic[maxCol] floatValue]) {
47 | maxCol = column;
48 | }
49 | }];
50 |
51 | return CGSizeMake(0, [self.colunMaxYDic[maxCol] floatValue]);
52 | }
53 |
54 | - (nullable UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath;
55 | {
56 | __block NSString * minCol = @"0";
57 | //遍历找出最短的列
58 | [self.colunMaxYDic enumerateKeysAndObjectsUsingBlock:^(NSString * column, NSNumber *maxY, BOOL *stop) {
59 | if ([maxY floatValue] < [self.colunMaxYDic[minCol] floatValue]) {
60 | minCol = column;
61 | }
62 | }];
63 |
64 | // 宽度
65 | CGFloat width = (self.collectionView.frame.size.width - self.sectionInset.left - self.sectionInset.right- (self.colCount-1) * self.itemSpacing)/self.colCount;
66 | // 高度
67 | CGFloat height = 0;
68 | if ([self.delegate respondsToSelector:@selector(collectionView:layout:heightForWidth:atIndexPath:)]) {
69 | height = [self.delegate collectionView:self.collectionView layout:self heightForWidth:width atIndexPath:indexPath];
70 | }
71 |
72 | CGFloat x = self.sectionInset.left + (width + self.itemSpacing) * [minCol intValue];
73 |
74 | CGFloat space = 0.0;
75 | if (indexPath.item < self.colCount) {
76 | space = 0.0;
77 | }else{
78 | space = self.lineSpacing;
79 | }
80 | CGFloat y =[self.colunMaxYDic[minCol] floatValue] + space;
81 |
82 | // 跟新对应列的高度
83 | self.colunMaxYDic[minCol] = @(y + height);
84 |
85 | // 计算位置
86 | UICollectionViewLayoutAttributes * attri = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
87 | attri.frame = CGRectMake(x, y, width, height);
88 |
89 | return attri;
90 | }
91 |
92 | - (nullable UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath{
93 |
94 | __block NSString * maxCol = @"0";
95 | //遍历找出最高的列
96 | [self.colunMaxYDic enumerateKeysAndObjectsUsingBlock:^(NSString * column, NSNumber *maxY, BOOL *stop) {
97 | if ([maxY floatValue] > [self.colunMaxYDic[maxCol] floatValue]) {
98 | maxCol = column;
99 | }
100 | }];
101 |
102 | //header
103 | if ([UICollectionElementKindSectionHeader isEqualToString:elementKind]) {
104 | UICollectionViewLayoutAttributes *attri = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader withIndexPath:indexPath];
105 | //size
106 | CGSize size = CGSizeZero;
107 | if ([self.delegate respondsToSelector:@selector(collectionView:layout:referenceSizeForHeaderInSection:)]) {
108 | size = [self.delegate collectionView:self.collectionView layout:self referenceSizeForHeaderInSection:indexPath.section];
109 | }
110 | CGFloat x = self.sectionInset.left;
111 | CGFloat y = [[self.colunMaxYDic objectForKey:maxCol] floatValue] + self.sectionInset.top;
112 |
113 | // 跟新所有对应列的高度
114 | for(NSString *key in self.colunMaxYDic.allKeys)
115 | {
116 | self.colunMaxYDic[key] = @(y + size.height);
117 | }
118 |
119 | attri.frame = CGRectMake(x , y, size.width, size.height);
120 | return attri;
121 | }
122 |
123 | //footer
124 | else{
125 | UICollectionViewLayoutAttributes *attri = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionFooter withIndexPath:indexPath];
126 | //size
127 | CGSize size = CGSizeZero;
128 | if ([self.delegate respondsToSelector:@selector(collectionView:layout:referenceSizeForFooterInSection:)]) {
129 | size = [self.delegate collectionView:self.collectionView layout:self referenceSizeForFooterInSection:indexPath.section];
130 | }
131 | CGFloat x = self.sectionInset.left;
132 | CGFloat y = [[self.colunMaxYDic objectForKey:maxCol] floatValue];
133 |
134 | // 跟新所有对应列的高度
135 | for(NSString *key in self.colunMaxYDic.allKeys)
136 | {
137 | self.colunMaxYDic[key] = @(y + size.height + self.sectionInset.bottom);
138 | }
139 |
140 | attri.frame = CGRectMake(x , y, size.width, size.height);
141 | return attri;
142 | }
143 | }
144 |
145 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
146 | {
147 | for(NSInteger i = 0;i < self.colCount; i++)
148 | {
149 | NSString * col = [NSString stringWithFormat:@"%ld",(long)i];
150 | self.colunMaxYDic[col] = @0;
151 | }
152 |
153 | NSMutableArray * attrsArray = [NSMutableArray array];
154 |
155 | NSInteger section = [self.collectionView numberOfSections];
156 | for (NSInteger i = 0 ; i < section; i++) {
157 |
158 | //获取header的UICollectionViewLayoutAttributes
159 | UICollectionViewLayoutAttributes *headerAttrs = [self layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:i]];
160 | [attrsArray addObject:headerAttrs];
161 |
162 | //获取item的UICollectionViewLayoutAttributes
163 | NSInteger count = [self.collectionView numberOfItemsInSection:i];
164 | for (NSInteger j = 0; j < count; j++) {
165 | UICollectionViewLayoutAttributes * attrs = [self layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:j inSection:i]];
166 | [attrsArray addObject:attrs];
167 | }
168 |
169 | //获取footer的UICollectionViewLayoutAttributes
170 | UICollectionViewLayoutAttributes *footerAttrs = [self layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionFooter atIndexPath:[NSIndexPath indexPathForItem:0 inSection:i]];
171 | [attrsArray addObject:footerAttrs];
172 | }
173 |
174 | return attrsArray;
175 | }
176 |
177 | @end
178 |
--------------------------------------------------------------------------------
/CustomerCollectionView/CustomerCollectionView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | DB043A0F1F2EDF63003AFA4D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DB043A0E1F2EDF63003AFA4D /* main.m */; };
11 | DB043A121F2EDF63003AFA4D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DB043A111F2EDF63003AFA4D /* AppDelegate.m */; };
12 | DB043A151F2EDF63003AFA4D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DB043A141F2EDF63003AFA4D /* ViewController.m */; };
13 | DB043A181F2EDF63003AFA4D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DB043A161F2EDF63003AFA4D /* Main.storyboard */; };
14 | DB043A1A1F2EDF63003AFA4D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DB043A191F2EDF63003AFA4D /* Assets.xcassets */; };
15 | DB043A1D1F2EDF63003AFA4D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DB043A1B1F2EDF63003AFA4D /* LaunchScreen.storyboard */; };
16 | DB043A281F2EDF63003AFA4D /* CustomerCollectionViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DB043A271F2EDF63003AFA4D /* CustomerCollectionViewTests.m */; };
17 | DB043A331F2EDF63003AFA4D /* CustomerCollectionViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = DB043A321F2EDF63003AFA4D /* CustomerCollectionViewUITests.m */; };
18 | DB043A431F2EDF75003AFA4D /* WHCWaterfallFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = DB043A421F2EDF75003AFA4D /* WHCWaterfallFlowLayout.m */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | DB043A241F2EDF63003AFA4D /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = DB043A021F2EDF63003AFA4D /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = DB043A091F2EDF63003AFA4D;
27 | remoteInfo = CustomerCollectionView;
28 | };
29 | DB043A2F1F2EDF63003AFA4D /* PBXContainerItemProxy */ = {
30 | isa = PBXContainerItemProxy;
31 | containerPortal = DB043A021F2EDF63003AFA4D /* Project object */;
32 | proxyType = 1;
33 | remoteGlobalIDString = DB043A091F2EDF63003AFA4D;
34 | remoteInfo = CustomerCollectionView;
35 | };
36 | /* End PBXContainerItemProxy section */
37 |
38 | /* Begin PBXFileReference section */
39 | DB043A0A1F2EDF63003AFA4D /* CustomerCollectionView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CustomerCollectionView.app; sourceTree = BUILT_PRODUCTS_DIR; };
40 | DB043A0E1F2EDF63003AFA4D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
41 | DB043A101F2EDF63003AFA4D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
42 | DB043A111F2EDF63003AFA4D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
43 | DB043A131F2EDF63003AFA4D /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
44 | DB043A141F2EDF63003AFA4D /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
45 | DB043A171F2EDF63003AFA4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
46 | DB043A191F2EDF63003AFA4D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
47 | DB043A1C1F2EDF63003AFA4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
48 | DB043A1E1F2EDF63003AFA4D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | DB043A231F2EDF63003AFA4D /* CustomerCollectionViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CustomerCollectionViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
50 | DB043A271F2EDF63003AFA4D /* CustomerCollectionViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomerCollectionViewTests.m; sourceTree = ""; };
51 | DB043A291F2EDF63003AFA4D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
52 | DB043A2E1F2EDF63003AFA4D /* CustomerCollectionViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CustomerCollectionViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
53 | DB043A321F2EDF63003AFA4D /* CustomerCollectionViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomerCollectionViewUITests.m; sourceTree = ""; };
54 | DB043A341F2EDF63003AFA4D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
55 | DB043A411F2EDF75003AFA4D /* WHCWaterfallFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WHCWaterfallFlowLayout.h; sourceTree = ""; };
56 | DB043A421F2EDF75003AFA4D /* WHCWaterfallFlowLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WHCWaterfallFlowLayout.m; sourceTree = ""; };
57 | /* End PBXFileReference section */
58 |
59 | /* Begin PBXFrameworksBuildPhase section */
60 | DB043A071F2EDF63003AFA4D /* Frameworks */ = {
61 | isa = PBXFrameworksBuildPhase;
62 | buildActionMask = 2147483647;
63 | files = (
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | DB043A201F2EDF63003AFA4D /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | );
72 | runOnlyForDeploymentPostprocessing = 0;
73 | };
74 | DB043A2B1F2EDF63003AFA4D /* Frameworks */ = {
75 | isa = PBXFrameworksBuildPhase;
76 | buildActionMask = 2147483647;
77 | files = (
78 | );
79 | runOnlyForDeploymentPostprocessing = 0;
80 | };
81 | /* End PBXFrameworksBuildPhase section */
82 |
83 | /* Begin PBXGroup section */
84 | DB043A011F2EDF63003AFA4D = {
85 | isa = PBXGroup;
86 | children = (
87 | DB043A0C1F2EDF63003AFA4D /* CustomerCollectionView */,
88 | DB043A261F2EDF63003AFA4D /* CustomerCollectionViewTests */,
89 | DB043A311F2EDF63003AFA4D /* CustomerCollectionViewUITests */,
90 | DB043A0B1F2EDF63003AFA4D /* Products */,
91 | );
92 | sourceTree = "";
93 | };
94 | DB043A0B1F2EDF63003AFA4D /* Products */ = {
95 | isa = PBXGroup;
96 | children = (
97 | DB043A0A1F2EDF63003AFA4D /* CustomerCollectionView.app */,
98 | DB043A231F2EDF63003AFA4D /* CustomerCollectionViewTests.xctest */,
99 | DB043A2E1F2EDF63003AFA4D /* CustomerCollectionViewUITests.xctest */,
100 | );
101 | name = Products;
102 | sourceTree = "";
103 | };
104 | DB043A0C1F2EDF63003AFA4D /* CustomerCollectionView */ = {
105 | isa = PBXGroup;
106 | children = (
107 | DB043A401F2EDF75003AFA4D /* WHCWaterFlowLayout */,
108 | DB043A101F2EDF63003AFA4D /* AppDelegate.h */,
109 | DB043A111F2EDF63003AFA4D /* AppDelegate.m */,
110 | DB043A131F2EDF63003AFA4D /* ViewController.h */,
111 | DB043A141F2EDF63003AFA4D /* ViewController.m */,
112 | DB043A161F2EDF63003AFA4D /* Main.storyboard */,
113 | DB043A191F2EDF63003AFA4D /* Assets.xcassets */,
114 | DB043A1B1F2EDF63003AFA4D /* LaunchScreen.storyboard */,
115 | DB043A1E1F2EDF63003AFA4D /* Info.plist */,
116 | DB043A0D1F2EDF63003AFA4D /* Supporting Files */,
117 | );
118 | path = CustomerCollectionView;
119 | sourceTree = "";
120 | };
121 | DB043A0D1F2EDF63003AFA4D /* Supporting Files */ = {
122 | isa = PBXGroup;
123 | children = (
124 | DB043A0E1F2EDF63003AFA4D /* main.m */,
125 | );
126 | name = "Supporting Files";
127 | sourceTree = "";
128 | };
129 | DB043A261F2EDF63003AFA4D /* CustomerCollectionViewTests */ = {
130 | isa = PBXGroup;
131 | children = (
132 | DB043A271F2EDF63003AFA4D /* CustomerCollectionViewTests.m */,
133 | DB043A291F2EDF63003AFA4D /* Info.plist */,
134 | );
135 | path = CustomerCollectionViewTests;
136 | sourceTree = "";
137 | };
138 | DB043A311F2EDF63003AFA4D /* CustomerCollectionViewUITests */ = {
139 | isa = PBXGroup;
140 | children = (
141 | DB043A321F2EDF63003AFA4D /* CustomerCollectionViewUITests.m */,
142 | DB043A341F2EDF63003AFA4D /* Info.plist */,
143 | );
144 | path = CustomerCollectionViewUITests;
145 | sourceTree = "";
146 | };
147 | DB043A401F2EDF75003AFA4D /* WHCWaterFlowLayout */ = {
148 | isa = PBXGroup;
149 | children = (
150 | DB043A411F2EDF75003AFA4D /* WHCWaterfallFlowLayout.h */,
151 | DB043A421F2EDF75003AFA4D /* WHCWaterfallFlowLayout.m */,
152 | );
153 | path = WHCWaterFlowLayout;
154 | sourceTree = "";
155 | };
156 | /* End PBXGroup section */
157 |
158 | /* Begin PBXNativeTarget section */
159 | DB043A091F2EDF63003AFA4D /* CustomerCollectionView */ = {
160 | isa = PBXNativeTarget;
161 | buildConfigurationList = DB043A371F2EDF63003AFA4D /* Build configuration list for PBXNativeTarget "CustomerCollectionView" */;
162 | buildPhases = (
163 | DB043A061F2EDF63003AFA4D /* Sources */,
164 | DB043A071F2EDF63003AFA4D /* Frameworks */,
165 | DB043A081F2EDF63003AFA4D /* Resources */,
166 | );
167 | buildRules = (
168 | );
169 | dependencies = (
170 | );
171 | name = CustomerCollectionView;
172 | productName = CustomerCollectionView;
173 | productReference = DB043A0A1F2EDF63003AFA4D /* CustomerCollectionView.app */;
174 | productType = "com.apple.product-type.application";
175 | };
176 | DB043A221F2EDF63003AFA4D /* CustomerCollectionViewTests */ = {
177 | isa = PBXNativeTarget;
178 | buildConfigurationList = DB043A3A1F2EDF63003AFA4D /* Build configuration list for PBXNativeTarget "CustomerCollectionViewTests" */;
179 | buildPhases = (
180 | DB043A1F1F2EDF63003AFA4D /* Sources */,
181 | DB043A201F2EDF63003AFA4D /* Frameworks */,
182 | DB043A211F2EDF63003AFA4D /* Resources */,
183 | );
184 | buildRules = (
185 | );
186 | dependencies = (
187 | DB043A251F2EDF63003AFA4D /* PBXTargetDependency */,
188 | );
189 | name = CustomerCollectionViewTests;
190 | productName = CustomerCollectionViewTests;
191 | productReference = DB043A231F2EDF63003AFA4D /* CustomerCollectionViewTests.xctest */;
192 | productType = "com.apple.product-type.bundle.unit-test";
193 | };
194 | DB043A2D1F2EDF63003AFA4D /* CustomerCollectionViewUITests */ = {
195 | isa = PBXNativeTarget;
196 | buildConfigurationList = DB043A3D1F2EDF63003AFA4D /* Build configuration list for PBXNativeTarget "CustomerCollectionViewUITests" */;
197 | buildPhases = (
198 | DB043A2A1F2EDF63003AFA4D /* Sources */,
199 | DB043A2B1F2EDF63003AFA4D /* Frameworks */,
200 | DB043A2C1F2EDF63003AFA4D /* Resources */,
201 | );
202 | buildRules = (
203 | );
204 | dependencies = (
205 | DB043A301F2EDF63003AFA4D /* PBXTargetDependency */,
206 | );
207 | name = CustomerCollectionViewUITests;
208 | productName = CustomerCollectionViewUITests;
209 | productReference = DB043A2E1F2EDF63003AFA4D /* CustomerCollectionViewUITests.xctest */;
210 | productType = "com.apple.product-type.bundle.ui-testing";
211 | };
212 | /* End PBXNativeTarget section */
213 |
214 | /* Begin PBXProject section */
215 | DB043A021F2EDF63003AFA4D /* Project object */ = {
216 | isa = PBXProject;
217 | attributes = {
218 | LastUpgradeCheck = 0830;
219 | ORGANIZATIONNAME = Wang;
220 | TargetAttributes = {
221 | DB043A091F2EDF63003AFA4D = {
222 | CreatedOnToolsVersion = 8.3.3;
223 | ProvisioningStyle = Automatic;
224 | };
225 | DB043A221F2EDF63003AFA4D = {
226 | CreatedOnToolsVersion = 8.3.3;
227 | ProvisioningStyle = Automatic;
228 | TestTargetID = DB043A091F2EDF63003AFA4D;
229 | };
230 | DB043A2D1F2EDF63003AFA4D = {
231 | CreatedOnToolsVersion = 8.3.3;
232 | ProvisioningStyle = Automatic;
233 | TestTargetID = DB043A091F2EDF63003AFA4D;
234 | };
235 | };
236 | };
237 | buildConfigurationList = DB043A051F2EDF63003AFA4D /* Build configuration list for PBXProject "CustomerCollectionView" */;
238 | compatibilityVersion = "Xcode 3.2";
239 | developmentRegion = English;
240 | hasScannedForEncodings = 0;
241 | knownRegions = (
242 | en,
243 | Base,
244 | );
245 | mainGroup = DB043A011F2EDF63003AFA4D;
246 | productRefGroup = DB043A0B1F2EDF63003AFA4D /* Products */;
247 | projectDirPath = "";
248 | projectRoot = "";
249 | targets = (
250 | DB043A091F2EDF63003AFA4D /* CustomerCollectionView */,
251 | DB043A221F2EDF63003AFA4D /* CustomerCollectionViewTests */,
252 | DB043A2D1F2EDF63003AFA4D /* CustomerCollectionViewUITests */,
253 | );
254 | };
255 | /* End PBXProject section */
256 |
257 | /* Begin PBXResourcesBuildPhase section */
258 | DB043A081F2EDF63003AFA4D /* Resources */ = {
259 | isa = PBXResourcesBuildPhase;
260 | buildActionMask = 2147483647;
261 | files = (
262 | DB043A1D1F2EDF63003AFA4D /* LaunchScreen.storyboard in Resources */,
263 | DB043A1A1F2EDF63003AFA4D /* Assets.xcassets in Resources */,
264 | DB043A181F2EDF63003AFA4D /* Main.storyboard in Resources */,
265 | );
266 | runOnlyForDeploymentPostprocessing = 0;
267 | };
268 | DB043A211F2EDF63003AFA4D /* Resources */ = {
269 | isa = PBXResourcesBuildPhase;
270 | buildActionMask = 2147483647;
271 | files = (
272 | );
273 | runOnlyForDeploymentPostprocessing = 0;
274 | };
275 | DB043A2C1F2EDF63003AFA4D /* Resources */ = {
276 | isa = PBXResourcesBuildPhase;
277 | buildActionMask = 2147483647;
278 | files = (
279 | );
280 | runOnlyForDeploymentPostprocessing = 0;
281 | };
282 | /* End PBXResourcesBuildPhase section */
283 |
284 | /* Begin PBXSourcesBuildPhase section */
285 | DB043A061F2EDF63003AFA4D /* Sources */ = {
286 | isa = PBXSourcesBuildPhase;
287 | buildActionMask = 2147483647;
288 | files = (
289 | DB043A151F2EDF63003AFA4D /* ViewController.m in Sources */,
290 | DB043A431F2EDF75003AFA4D /* WHCWaterfallFlowLayout.m in Sources */,
291 | DB043A121F2EDF63003AFA4D /* AppDelegate.m in Sources */,
292 | DB043A0F1F2EDF63003AFA4D /* main.m in Sources */,
293 | );
294 | runOnlyForDeploymentPostprocessing = 0;
295 | };
296 | DB043A1F1F2EDF63003AFA4D /* Sources */ = {
297 | isa = PBXSourcesBuildPhase;
298 | buildActionMask = 2147483647;
299 | files = (
300 | DB043A281F2EDF63003AFA4D /* CustomerCollectionViewTests.m in Sources */,
301 | );
302 | runOnlyForDeploymentPostprocessing = 0;
303 | };
304 | DB043A2A1F2EDF63003AFA4D /* Sources */ = {
305 | isa = PBXSourcesBuildPhase;
306 | buildActionMask = 2147483647;
307 | files = (
308 | DB043A331F2EDF63003AFA4D /* CustomerCollectionViewUITests.m in Sources */,
309 | );
310 | runOnlyForDeploymentPostprocessing = 0;
311 | };
312 | /* End PBXSourcesBuildPhase section */
313 |
314 | /* Begin PBXTargetDependency section */
315 | DB043A251F2EDF63003AFA4D /* PBXTargetDependency */ = {
316 | isa = PBXTargetDependency;
317 | target = DB043A091F2EDF63003AFA4D /* CustomerCollectionView */;
318 | targetProxy = DB043A241F2EDF63003AFA4D /* PBXContainerItemProxy */;
319 | };
320 | DB043A301F2EDF63003AFA4D /* PBXTargetDependency */ = {
321 | isa = PBXTargetDependency;
322 | target = DB043A091F2EDF63003AFA4D /* CustomerCollectionView */;
323 | targetProxy = DB043A2F1F2EDF63003AFA4D /* PBXContainerItemProxy */;
324 | };
325 | /* End PBXTargetDependency section */
326 |
327 | /* Begin PBXVariantGroup section */
328 | DB043A161F2EDF63003AFA4D /* Main.storyboard */ = {
329 | isa = PBXVariantGroup;
330 | children = (
331 | DB043A171F2EDF63003AFA4D /* Base */,
332 | );
333 | name = Main.storyboard;
334 | sourceTree = "";
335 | };
336 | DB043A1B1F2EDF63003AFA4D /* LaunchScreen.storyboard */ = {
337 | isa = PBXVariantGroup;
338 | children = (
339 | DB043A1C1F2EDF63003AFA4D /* Base */,
340 | );
341 | name = LaunchScreen.storyboard;
342 | sourceTree = "";
343 | };
344 | /* End PBXVariantGroup section */
345 |
346 | /* Begin XCBuildConfiguration section */
347 | DB043A351F2EDF63003AFA4D /* Debug */ = {
348 | isa = XCBuildConfiguration;
349 | buildSettings = {
350 | ALWAYS_SEARCH_USER_PATHS = NO;
351 | CLANG_ANALYZER_NONNULL = YES;
352 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
353 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
354 | CLANG_CXX_LIBRARY = "libc++";
355 | CLANG_ENABLE_MODULES = YES;
356 | CLANG_ENABLE_OBJC_ARC = YES;
357 | CLANG_WARN_BOOL_CONVERSION = YES;
358 | CLANG_WARN_CONSTANT_CONVERSION = YES;
359 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
360 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
361 | CLANG_WARN_EMPTY_BODY = YES;
362 | CLANG_WARN_ENUM_CONVERSION = YES;
363 | CLANG_WARN_INFINITE_RECURSION = YES;
364 | CLANG_WARN_INT_CONVERSION = YES;
365 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
366 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
367 | CLANG_WARN_UNREACHABLE_CODE = YES;
368 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
369 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
370 | COPY_PHASE_STRIP = NO;
371 | DEBUG_INFORMATION_FORMAT = dwarf;
372 | ENABLE_STRICT_OBJC_MSGSEND = YES;
373 | ENABLE_TESTABILITY = YES;
374 | GCC_C_LANGUAGE_STANDARD = gnu99;
375 | GCC_DYNAMIC_NO_PIC = NO;
376 | GCC_NO_COMMON_BLOCKS = YES;
377 | GCC_OPTIMIZATION_LEVEL = 0;
378 | GCC_PREPROCESSOR_DEFINITIONS = (
379 | "DEBUG=1",
380 | "$(inherited)",
381 | );
382 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
383 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
384 | GCC_WARN_UNDECLARED_SELECTOR = YES;
385 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
386 | GCC_WARN_UNUSED_FUNCTION = YES;
387 | GCC_WARN_UNUSED_VARIABLE = YES;
388 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
389 | MTL_ENABLE_DEBUG_INFO = YES;
390 | ONLY_ACTIVE_ARCH = YES;
391 | SDKROOT = iphoneos;
392 | TARGETED_DEVICE_FAMILY = "1,2";
393 | };
394 | name = Debug;
395 | };
396 | DB043A361F2EDF63003AFA4D /* Release */ = {
397 | isa = XCBuildConfiguration;
398 | buildSettings = {
399 | ALWAYS_SEARCH_USER_PATHS = NO;
400 | CLANG_ANALYZER_NONNULL = YES;
401 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
402 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
403 | CLANG_CXX_LIBRARY = "libc++";
404 | CLANG_ENABLE_MODULES = YES;
405 | CLANG_ENABLE_OBJC_ARC = YES;
406 | CLANG_WARN_BOOL_CONVERSION = YES;
407 | CLANG_WARN_CONSTANT_CONVERSION = YES;
408 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
409 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
410 | CLANG_WARN_EMPTY_BODY = YES;
411 | CLANG_WARN_ENUM_CONVERSION = YES;
412 | CLANG_WARN_INFINITE_RECURSION = YES;
413 | CLANG_WARN_INT_CONVERSION = YES;
414 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
415 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
416 | CLANG_WARN_UNREACHABLE_CODE = YES;
417 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
418 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
419 | COPY_PHASE_STRIP = NO;
420 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
421 | ENABLE_NS_ASSERTIONS = NO;
422 | ENABLE_STRICT_OBJC_MSGSEND = YES;
423 | GCC_C_LANGUAGE_STANDARD = gnu99;
424 | GCC_NO_COMMON_BLOCKS = YES;
425 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
426 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
427 | GCC_WARN_UNDECLARED_SELECTOR = YES;
428 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
429 | GCC_WARN_UNUSED_FUNCTION = YES;
430 | GCC_WARN_UNUSED_VARIABLE = YES;
431 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
432 | MTL_ENABLE_DEBUG_INFO = NO;
433 | SDKROOT = iphoneos;
434 | TARGETED_DEVICE_FAMILY = "1,2";
435 | VALIDATE_PRODUCT = YES;
436 | };
437 | name = Release;
438 | };
439 | DB043A381F2EDF63003AFA4D /* Debug */ = {
440 | isa = XCBuildConfiguration;
441 | buildSettings = {
442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
443 | INFOPLIST_FILE = CustomerCollectionView/Info.plist;
444 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
445 | PRODUCT_BUNDLE_IDENTIFIER = hz.CustomerCollectionView;
446 | PRODUCT_NAME = "$(TARGET_NAME)";
447 | };
448 | name = Debug;
449 | };
450 | DB043A391F2EDF63003AFA4D /* Release */ = {
451 | isa = XCBuildConfiguration;
452 | buildSettings = {
453 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
454 | INFOPLIST_FILE = CustomerCollectionView/Info.plist;
455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
456 | PRODUCT_BUNDLE_IDENTIFIER = hz.CustomerCollectionView;
457 | PRODUCT_NAME = "$(TARGET_NAME)";
458 | };
459 | name = Release;
460 | };
461 | DB043A3B1F2EDF63003AFA4D /* Debug */ = {
462 | isa = XCBuildConfiguration;
463 | buildSettings = {
464 | BUNDLE_LOADER = "$(TEST_HOST)";
465 | INFOPLIST_FILE = CustomerCollectionViewTests/Info.plist;
466 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
467 | PRODUCT_BUNDLE_IDENTIFIER = hz.CustomerCollectionViewTests;
468 | PRODUCT_NAME = "$(TARGET_NAME)";
469 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CustomerCollectionView.app/CustomerCollectionView";
470 | };
471 | name = Debug;
472 | };
473 | DB043A3C1F2EDF63003AFA4D /* Release */ = {
474 | isa = XCBuildConfiguration;
475 | buildSettings = {
476 | BUNDLE_LOADER = "$(TEST_HOST)";
477 | INFOPLIST_FILE = CustomerCollectionViewTests/Info.plist;
478 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
479 | PRODUCT_BUNDLE_IDENTIFIER = hz.CustomerCollectionViewTests;
480 | PRODUCT_NAME = "$(TARGET_NAME)";
481 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CustomerCollectionView.app/CustomerCollectionView";
482 | };
483 | name = Release;
484 | };
485 | DB043A3E1F2EDF63003AFA4D /* Debug */ = {
486 | isa = XCBuildConfiguration;
487 | buildSettings = {
488 | INFOPLIST_FILE = CustomerCollectionViewUITests/Info.plist;
489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
490 | PRODUCT_BUNDLE_IDENTIFIER = hz.CustomerCollectionViewUITests;
491 | PRODUCT_NAME = "$(TARGET_NAME)";
492 | TEST_TARGET_NAME = CustomerCollectionView;
493 | };
494 | name = Debug;
495 | };
496 | DB043A3F1F2EDF63003AFA4D /* Release */ = {
497 | isa = XCBuildConfiguration;
498 | buildSettings = {
499 | INFOPLIST_FILE = CustomerCollectionViewUITests/Info.plist;
500 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
501 | PRODUCT_BUNDLE_IDENTIFIER = hz.CustomerCollectionViewUITests;
502 | PRODUCT_NAME = "$(TARGET_NAME)";
503 | TEST_TARGET_NAME = CustomerCollectionView;
504 | };
505 | name = Release;
506 | };
507 | /* End XCBuildConfiguration section */
508 |
509 | /* Begin XCConfigurationList section */
510 | DB043A051F2EDF63003AFA4D /* Build configuration list for PBXProject "CustomerCollectionView" */ = {
511 | isa = XCConfigurationList;
512 | buildConfigurations = (
513 | DB043A351F2EDF63003AFA4D /* Debug */,
514 | DB043A361F2EDF63003AFA4D /* Release */,
515 | );
516 | defaultConfigurationIsVisible = 0;
517 | defaultConfigurationName = Release;
518 | };
519 | DB043A371F2EDF63003AFA4D /* Build configuration list for PBXNativeTarget "CustomerCollectionView" */ = {
520 | isa = XCConfigurationList;
521 | buildConfigurations = (
522 | DB043A381F2EDF63003AFA4D /* Debug */,
523 | DB043A391F2EDF63003AFA4D /* Release */,
524 | );
525 | defaultConfigurationIsVisible = 0;
526 | };
527 | DB043A3A1F2EDF63003AFA4D /* Build configuration list for PBXNativeTarget "CustomerCollectionViewTests" */ = {
528 | isa = XCConfigurationList;
529 | buildConfigurations = (
530 | DB043A3B1F2EDF63003AFA4D /* Debug */,
531 | DB043A3C1F2EDF63003AFA4D /* Release */,
532 | );
533 | defaultConfigurationIsVisible = 0;
534 | };
535 | DB043A3D1F2EDF63003AFA4D /* Build configuration list for PBXNativeTarget "CustomerCollectionViewUITests" */ = {
536 | isa = XCConfigurationList;
537 | buildConfigurations = (
538 | DB043A3E1F2EDF63003AFA4D /* Debug */,
539 | DB043A3F1F2EDF63003AFA4D /* Release */,
540 | );
541 | defaultConfigurationIsVisible = 0;
542 | };
543 | /* End XCConfigurationList section */
544 | };
545 | rootObject = DB043A021F2EDF63003AFA4D /* Project object */;
546 | }
547 |
--------------------------------------------------------------------------------