├── .gitignore ├── README.md ├── README.md.zip └── YXCollectionView ├── YXCollectionView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── yixiang.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── yixiang.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── YXCollectionView.xcscheme │ └── xcschememanagement.plist └── YXCollectionView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Contents.json └── Full │ ├── 0_full.imageset │ ├── 0_full.JPG │ └── Contents.json │ ├── 10_full.imageset │ ├── 10_full.JPG │ └── Contents.json │ ├── 11_full.imageset │ ├── 11_full.JPG │ └── Contents.json │ ├── 12_full.imageset │ ├── 12_full.JPG │ └── Contents.json │ ├── 13_full.imageset │ ├── 13_full.JPG │ └── Contents.json │ ├── 14_full.imageset │ ├── 14_full.JPG │ └── Contents.json │ ├── 15_full.imageset │ ├── 15_full.JPG │ └── Contents.json │ ├── 16_full.imageset │ ├── 16_full.JPG │ └── Contents.json │ ├── 17_full.imageset │ ├── 17_full.JPG │ └── Contents.json │ ├── 18_full.imageset │ ├── 18_full.JPG │ └── Contents.json │ ├── 19_full.imageset │ ├── 19_full.JPG │ └── Contents.json │ ├── 1_full.imageset │ ├── 1_full.JPG │ └── Contents.json │ ├── 20_full.imageset │ ├── 20_full.JPG │ └── Contents.json │ ├── 21_full.imageset │ ├── 21_full.JPG │ └── Contents.json │ ├── 22_full.imageset │ ├── 22_full.JPG │ └── Contents.json │ ├── 23_full.imageset │ ├── 23_full.JPG │ └── Contents.json │ ├── 24_full.imageset │ ├── 24_full.JPG │ └── Contents.json │ ├── 25_full.imageset │ ├── 25_full.JPG │ └── Contents.json │ ├── 26_full.imageset │ ├── 26_full.JPG │ └── Contents.json │ ├── 27_full.imageset │ ├── 27_full.JPG │ └── Contents.json │ ├── 28_full.imageset │ ├── 28_full.JPG │ └── Contents.json │ ├── 29_full.imageset │ ├── 29_full.JPG │ └── Contents.json │ ├── 2_full.imageset │ ├── 2_full.JPG │ └── Contents.json │ ├── 30_full.imageset │ ├── 30_full.JPG │ └── Contents.json │ ├── 31_full.imageset │ ├── 31_full.JPG │ └── Contents.json │ ├── 3_full.imageset │ ├── 3_full.JPG │ └── Contents.json │ ├── 4_full.imageset │ ├── 4_full.JPG │ └── Contents.json │ ├── 5_full.imageset │ ├── 5_full.JPG │ └── Contents.json │ ├── 6_full.imageset │ ├── 6_full.JPG │ └── Contents.json │ ├── 7_full.imageset │ ├── 7_full.JPG │ └── Contents.json │ ├── 8_full.imageset │ ├── 8_full.JPG │ └── Contents.json │ ├── 9_full.imageset │ ├── 9_full.JPG │ └── Contents.json │ ├── Contents.json │ └── Thumb │ ├── 0.imageset │ ├── 0.JPG │ └── Contents.json │ ├── 1.imageset │ ├── 1.JPG │ └── Contents.json │ ├── 10.imageset │ ├── 10.JPG │ └── Contents.json │ ├── 11.imageset │ ├── 11.JPG │ └── Contents.json │ ├── 12.imageset │ ├── 12.JPG │ └── Contents.json │ ├── 13.imageset │ ├── 13.JPG │ └── Contents.json │ ├── 14.imageset │ ├── 14.JPG │ └── Contents.json │ ├── 15.imageset │ ├── 15.JPG │ └── Contents.json │ ├── 16.imageset │ ├── 16.JPG │ └── Contents.json │ ├── 17.imageset │ ├── 17.JPG │ └── Contents.json │ ├── 18.imageset │ ├── 18.JPG │ └── Contents.json │ ├── 19.imageset │ ├── 19.JPG │ └── Contents.json │ ├── 2.imageset │ ├── 2.JPG │ └── Contents.json │ ├── 20.imageset │ ├── 20.JPG │ └── Contents.json │ ├── 21.imageset │ ├── 21.JPG │ └── Contents.json │ ├── 22.imageset │ ├── 22.JPG │ └── Contents.json │ ├── 23.imageset │ ├── 23.JPG │ └── Contents.json │ ├── 24.imageset │ ├── 24.JPG │ └── Contents.json │ ├── 25.imageset │ ├── 25.JPG │ └── Contents.json │ ├── 26.imageset │ ├── 26.JPG │ └── Contents.json │ ├── 27.imageset │ ├── 27.JPG │ └── Contents.json │ ├── 28.imageset │ ├── 28.JPG │ └── Contents.json │ ├── 29.imageset │ ├── 29.JPG │ └── Contents.json │ ├── 3.imageset │ ├── 3.JPG │ └── Contents.json │ ├── 30.imageset │ ├── 30.JPG │ └── Contents.json │ ├── 31.imageset │ ├── 31.JPG │ └── Contents.json │ ├── 4.imageset │ ├── 4.JPG │ └── Contents.json │ ├── 5.imageset │ ├── 5.JPG │ └── Contents.json │ ├── 6.imageset │ ├── 6.JPG │ └── Contents.json │ ├── 7.imageset │ ├── 7.JPG │ └── Contents.json │ ├── 8.imageset │ ├── 8.JPG │ └── Contents.json │ ├── 9.imageset │ ├── 9.JPG │ └── Contents.json │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── CenterPage ├── Controller │ ├── BaseViewController.h │ ├── BaseViewController.m │ ├── Demo1 │ │ ├── Demo1Cell.h │ │ ├── Demo1Cell.m │ │ ├── Demo1ViewController.h │ │ └── Demo1ViewController.m │ ├── Demo2 │ │ ├── Demo2ViewController.h │ │ ├── Demo2ViewController.m │ │ ├── YYCell.h │ │ ├── YYCell.m │ │ ├── YYNews.h │ │ └── YYNews.m │ ├── Demo3 │ │ ├── Demo3Cell.h │ │ ├── Demo3Cell.m │ │ ├── Demo3HeaderView.h │ │ ├── Demo3HeaderView.m │ │ ├── Demo3ViewController.h │ │ └── Demo3ViewController.m │ ├── Demo4 │ │ ├── Demo4ViewController.h │ │ ├── Demo4ViewController.m │ │ ├── WaterfallCell.h │ │ └── WaterfallCell.m │ ├── Demo5 │ │ ├── Demo5Cell.h │ │ ├── Demo5Cell.m │ │ ├── Demo5HeaderView.h │ │ ├── Demo5HeaderView.m │ │ ├── Demo5ViewController.h │ │ ├── Demo5ViewController.m │ │ ├── StretchyHeaderCollectionViewLayout.h │ │ └── StretchyHeaderCollectionViewLayout.m │ ├── Demo6 │ │ ├── Demo6Cell.h │ │ ├── Demo6Cell.m │ │ ├── Demo6ViewController.h │ │ ├── Demo6ViewController.m │ │ ├── TiltedLayout.h │ │ └── TiltedLayout.m │ └── Demo7 │ │ ├── Demo7ViewController.h │ │ ├── Demo7ViewController.m │ │ ├── RPSlidingMenuCell.h │ │ ├── RPSlidingMenuCell.m │ │ ├── RPSlidingMenuLayout.h │ │ └── RPSlidingMenuLayout.m └── View │ └── DDCollectionViewFlowLayout │ ├── DDCollectionViewFlowLayout.h │ └── DDCollectionViewFlowLayout.m ├── Image ├── 01.jpg ├── 02.jpg ├── 03.jpg ├── 04.jpg └── 05.jpg ├── Info.plist ├── LeftPage ├── LeftViewController.h └── LeftViewController.m ├── PrefixHeader.pch ├── RightPage ├── RightViewController.h └── RightViewController.m ├── SWRevealViewController ├── SWRevealViewController.h └── SWRevealViewController.m ├── ViewController.h ├── ViewController.m ├── main.m └── resource.plist /.gitignore: -------------------------------------------------------------------------------- 1 | DerivedData/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##本DEMO总共包括7个案例,分别如下:
2 | ###Demo1:网格视图
3 | ![网格视图](http://img.my.csdn.net/uploads/201512/24/1450924992_6572.gif)
4 | ###Demo2:无限轮播
5 | ![无限轮播](http://img.my.csdn.net/uploads/201512/24/1450924937_1121.gif)
6 | ###Demo3:照片墙
7 | ![照片墙](http://img.my.csdn.net/uploads/201512/24/1450924937_2933.gif)
8 | ###Demo4:瀑布流
9 | ![瀑布流](http://img.my.csdn.net/uploads/201512/24/1450924938_5353.gif)
10 | ###Demo5:列表头部拉伸效果
11 | ![列表头部拉升效果](http://img.my.csdn.net/uploads/201512/24/1450924939_8493.gif)
12 | ###Demo6:倾斜的Cell
13 | ![倾斜的cell](http://img.my.csdn.net/uploads/201512/14/1450064085_6773.gif)
14 | ###Demo7:列表顶部逐渐增大效果
15 | ![列表顶部逐渐增大效果](http://img.my.csdn.net/uploads/201512/24/1450925034_1941.gif)
16 | 17 | ##一、UICollectionView的简介 18 | UICollectionView是IOS 6中引进的列表展现控件,用于展示集合视图,布局更加灵活,可以高度定制内容的展现,可以有效的进行数据管理,即使对于大量数据,也非常的高效。苹果官方给出了Demo([点我下载](https://developer.apple.com/library/ios/samplecode/CollectionView-Simple/Introduction/Intro.html#//apple_ref/doc/uid/DTS40012860))是一个类似于Android里面的GridView的实现。和UITableView的实现相比较,他对于每一个Item都是一次复用,而UITableView只能对于每一行进行复用。如果你认为它仅仅是对GridView在IOS中的实现的话,那你就太小看它的功能了。下面我们就来一起学习UICollectionView的使用方法。 19 | 20 | ##二、UICollectionView的感性认识 21 | 网上有一个书架的举例很经典,很好的说明了UICollectionView的表现形式。如图:![书架案例](http://img.my.csdn.net/uploads/201511/06/1446790428_7727.png) 22 | 一个标准的UICollectionView包含三个部分,他们都是UIView的子类: 23 | 24 | - Cells 用于展示内容的主体,对于不同的Cell可以指定不同的尺寸和内容。 25 | - Supplementary Views 附加视图,可以理解为UITableView每个Section的HeaderView和FooterView。 26 | - Decoration Views 装饰视图,这是每个section的背景视图,用于装饰该section。 27 | 28 | 将上图分解为以上三个元素组成的结构,如下图所示: 29 | ![书架分解图](http://img.my.csdn.net/uploads/201511/06/1446790216_9577.jpg) 30 | 31 | ##三、基本原理 32 | UICollectionView 向 UICollectionViewLayout 询问布局,当询问过程发生时,layout 对象会创建 UICollectionViewLayoutAttributes 实例。一个 UICollectionViewLayoutAttributes 对象管理着一个对应的 item layout 相关信息(一对一关系) 33 | 34 | ##四、案例学习地址 35 | 1:[网格视图](http://blog.csdn.net/yixiangboy/article/details/49683345)
36 | 2:[无限轮播](http://blog.csdn.net/yixiangboy/article/details/49705953)
37 | 3:[列表头部拉伸效果](http://blog.csdn.net/yixiangboy/article/details/49718197)
38 | 4:[倾斜列表效果](http://blog.csdn.net/yixiangboy/article/details/49795431)
39 | 40 | ##五、Demo下载地址 41 | [Demo下载地址](https://github.com/yixiangboy/YXCollectionView.git) 42 | 如果对你有点帮助,star一下吧。 43 | 44 | ##六、联系方式(欢迎关注,欢迎加好友) 45 | 微博:[新浪微博](http://weibo.com/5612984599/profile?topnav=1&wvr=6)
46 | 博客:[http://blog.csdn.net/yixiangboy ](http://blog.csdn.net/yixiangboy)
47 | github:[https://github.com/yixiangboy](https://github.com/yixiangboy)
48 | -------------------------------------------------------------------------------- /README.md.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/README.md.zip -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView.xcodeproj/project.xcworkspace/xcuserdata/yixiang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView.xcodeproj/project.xcworkspace/xcuserdata/yixiang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView.xcodeproj/xcuserdata/yixiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView.xcodeproj/xcuserdata/yixiang.xcuserdatad/xcschemes/YXCollectionView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView.xcodeproj/xcuserdata/yixiang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | YXCollectionView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | DADDB53D1BC911B00029AC56 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. 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 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "LeftViewController.h" 11 | #import "Demo1ViewController.h" 12 | #import "RightViewController.h" 13 | #import "SWRevealViewController.h" 14 | 15 | @interface AppDelegate () 16 | 17 | @end 18 | 19 | @implementation AppDelegate 20 | 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | // Override point for customization after application launch. 24 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 25 | 26 | //左侧菜单栏 27 | LeftViewController *leftViewController = [[LeftViewController alloc] init]; 28 | 29 | //首页 30 | Demo1ViewController *centerView1Controller = [[Demo1ViewController alloc] init]; 31 | 32 | //右侧菜单栏 33 | RightViewController *rightViewController = [[RightViewController alloc] init]; 34 | 35 | SWRevealViewController *revealViewController = [[SWRevealViewController alloc] initWithRearViewController:leftViewController frontViewController:centerView1Controller]; 36 | revealViewController.rightViewController = rightViewController; 37 | 38 | //浮动层离左边距的宽度 39 | revealViewController.rearViewRevealWidth = 230; 40 | // revealViewController.rightViewRevealWidth = 230; 41 | 42 | //是否让浮动层弹回原位 43 | //mainRevealController.bounceBackOnOverdraw = NO; 44 | [revealViewController setFrontViewPosition:FrontViewPositionLeft animated:YES]; 45 | 46 | self.window.rootViewController = revealViewController; 47 | self.window.backgroundColor = [UIColor whiteColor]; 48 | [self.window makeKeyAndVisible]; 49 | return YES; 50 | } 51 | 52 | - (void)applicationWillResignActive:(UIApplication *)application { 53 | // 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. 54 | // 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. 55 | } 56 | 57 | - (void)applicationDidEnterBackground:(UIApplication *)application { 58 | // 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. 59 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 60 | } 61 | 62 | - (void)applicationWillEnterForeground:(UIApplication *)application { 63 | // 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. 64 | } 65 | 66 | - (void)applicationDidBecomeActive:(UIApplication *)application { 67 | // 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. 68 | } 69 | 70 | - (void)applicationWillTerminate:(UIApplication *)application { 71 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/0_full.imageset/0_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/0_full.imageset/0_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/0_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "0_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/10_full.imageset/10_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/10_full.imageset/10_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/10_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "10_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/11_full.imageset/11_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/11_full.imageset/11_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/11_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "11_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/12_full.imageset/12_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/12_full.imageset/12_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/12_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "12_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/13_full.imageset/13_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/13_full.imageset/13_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/13_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "13_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/14_full.imageset/14_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/14_full.imageset/14_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/14_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "14_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/15_full.imageset/15_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/15_full.imageset/15_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/15_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "15_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/16_full.imageset/16_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/16_full.imageset/16_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/16_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "16_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/17_full.imageset/17_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/17_full.imageset/17_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/17_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "17_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/18_full.imageset/18_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/18_full.imageset/18_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/18_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "18_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/19_full.imageset/19_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/19_full.imageset/19_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/19_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "19_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/1_full.imageset/1_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/1_full.imageset/1_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/1_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/20_full.imageset/20_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/20_full.imageset/20_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/20_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "20_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/21_full.imageset/21_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/21_full.imageset/21_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/21_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "21_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/22_full.imageset/22_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/22_full.imageset/22_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/22_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "22_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/23_full.imageset/23_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/23_full.imageset/23_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/23_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "23_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/24_full.imageset/24_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/24_full.imageset/24_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/24_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "24_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/25_full.imageset/25_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/25_full.imageset/25_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/25_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "25_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/26_full.imageset/26_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/26_full.imageset/26_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/26_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "26_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/27_full.imageset/27_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/27_full.imageset/27_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/27_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "27_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/28_full.imageset/28_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/28_full.imageset/28_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/28_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "28_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/29_full.imageset/29_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/29_full.imageset/29_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/29_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "29_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/2_full.imageset/2_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/2_full.imageset/2_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/2_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/30_full.imageset/30_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/30_full.imageset/30_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/30_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "30_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/31_full.imageset/31_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/31_full.imageset/31_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/31_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "31_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/3_full.imageset/3_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/3_full.imageset/3_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/3_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/4_full.imageset/4_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/4_full.imageset/4_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/4_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/5_full.imageset/5_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/5_full.imageset/5_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/5_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/6_full.imageset/6_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/6_full.imageset/6_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/6_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "6_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/7_full.imageset/7_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/7_full.imageset/7_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/7_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "7_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/8_full.imageset/8_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/8_full.imageset/8_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/8_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "8_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/9_full.imageset/9_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/9_full.imageset/9_full.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/9_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "9_full.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/0.imageset/0.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/0.imageset/0.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "0.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/1.imageset/1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/1.imageset/1.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/10.imageset/10.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/10.imageset/10.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/10.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "10.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/11.imageset/11.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/11.imageset/11.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/11.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "11.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/12.imageset/12.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/12.imageset/12.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "12.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/13.imageset/13.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/13.imageset/13.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/13.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "13.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/14.imageset/14.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/14.imageset/14.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/14.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "14.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/15.imageset/15.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/15.imageset/15.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/15.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "15.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/16.imageset/16.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/16.imageset/16.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/16.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "16.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/17.imageset/17.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/17.imageset/17.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/17.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "17.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/18.imageset/18.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/18.imageset/18.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/18.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "18.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/19.imageset/19.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/19.imageset/19.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/19.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "19.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/2.imageset/2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/2.imageset/2.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/20.imageset/20.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/20.imageset/20.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/20.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "20.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/21.imageset/21.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/21.imageset/21.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/21.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "21.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/22.imageset/22.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/22.imageset/22.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/22.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "22.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/23.imageset/23.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/23.imageset/23.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/23.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "23.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/24.imageset/24.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/24.imageset/24.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/24.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "24.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/25.imageset/25.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/25.imageset/25.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/25.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "25.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/26.imageset/26.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/26.imageset/26.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/26.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "26.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/27.imageset/27.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/27.imageset/27.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/27.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "27.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/28.imageset/28.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/28.imageset/28.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/28.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "28.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/29.imageset/29.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/29.imageset/29.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/29.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "29.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/3.imageset/3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/3.imageset/3.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/30.imageset/30.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/30.imageset/30.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/30.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "30.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/31.imageset/31.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/31.imageset/31.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/31.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "31.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/4.imageset/4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/4.imageset/4.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/5.imageset/5.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/5.imageset/5.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/6.imageset/6.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/6.imageset/6.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "6.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/7.imageset/7.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/7.imageset/7.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "7.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/8.imageset/8.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/8.imageset/8.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "8.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/9.imageset/9.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/9.imageset/9.JPG -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "9.JPG", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Assets.xcassets/Full/Thumb/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/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 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/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 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // 侧滑菜单 4 | // 5 | // Created by yixiang on 15/7/18. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | @interface BaseViewController : UIViewController 11 | 12 | /** 13 | * 当前Controller的标题 14 | * 15 | * @return 标题 16 | */ 17 | -(NSString *)controllerTitle; 18 | 19 | /** 20 | * 初始化View 21 | */ 22 | -(void)initView; 23 | 24 | @property (nonatomic , assign) CGFloat navBarHeight; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // 侧滑菜单 4 | // 5 | // Created by yixiang on 15/7/18. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | #import "SWRevealViewController.h" 11 | 12 | @interface BaseViewController () 13 | 14 | @property (nonatomic , strong) NSArray *operateTitleArray; 15 | 16 | @end 17 | 18 | @implementation BaseViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | } 23 | 24 | -(void)initView{ 25 | 26 | UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH ,60)]; 27 | _navBarHeight = 60; 28 | containerView.backgroundColor = [UIColor cyanColor]; 29 | [self.view addSubview:containerView]; 30 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, SCREEN_WIDTH, 40)]; 31 | label.textAlignment = NSTextAlignmentCenter; 32 | label.text = [self controllerTitle]; 33 | [containerView addSubview:label]; 34 | 35 | self.view.backgroundColor = [UIColor whiteColor]; 36 | 37 | //注册该页面可以执行滑动切换 38 | SWRevealViewController *revealController = self.revealViewController; 39 | [self.view addGestureRecognizer:revealController.panGestureRecognizer]; 40 | } 41 | 42 | -(NSString *)controllerTitle{ 43 | return @"默认标题"; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo1/Demo1Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo1Cell.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/11. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Demo1Cell : UICollectionViewCell 12 | 13 | - (void)setImageName : (NSString *)imageName content : (NSString *)content; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo1/Demo1Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo1Cell.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/11. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo1Cell.h" 10 | 11 | @interface Demo1Cell () 12 | 13 | @property (nonatomic , strong) UIImageView *imageShow; 14 | 15 | @property (nonatomic , strong) UILabel *labelShow; 16 | 17 | @end 18 | 19 | @implementation Demo1Cell 20 | 21 | -(instancetype) initWithFrame:(CGRect)frame{ 22 | self = [super initWithFrame:frame]; 23 | if (self) { 24 | UIImageView *imageShow = [[UIImageView alloc] initWithFrame:CGRectZero]; 25 | [self.contentView addSubview:imageShow]; 26 | _imageShow = imageShow; 27 | 28 | UILabel *labelShow = [[UILabel alloc] initWithFrame:CGRectZero]; 29 | labelShow.font = [UIFont systemFontOfSize:15]; 30 | labelShow.textColor = [UIColor whiteColor]; 31 | labelShow.textAlignment = NSTextAlignmentCenter; 32 | [self.contentView addSubview:labelShow]; 33 | _labelShow = labelShow; 34 | 35 | } 36 | return self; 37 | } 38 | 39 | - (void)layoutSubviews{ 40 | [super layoutSubviews]; 41 | _imageShow.frame = CGRectMake(10, 0, SCREEN_WIDTH/2-30, SCREEN_WIDTH/2-30); 42 | _labelShow.frame = CGRectMake(10, SCREEN_WIDTH/2-30, SCREEN_WIDTH/2-30, 15); 43 | 44 | } 45 | 46 | - (void)setImageName : (NSString *)imageName content : (NSString *)content{ 47 | _imageShow.image = [UIImage imageNamed:imageName]; 48 | _labelShow.text = content; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo1/Demo1ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo1ViewController.h 3 | // YXUICollectionViewDemo 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface Demo1ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo1/Demo1ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo1ViewController.m 3 | // YXUICollectionViewDemo 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo1ViewController.h" 10 | #import "Demo1Cell.h" 11 | 12 | #define Demo1CellID @"demo1_cell_id" 13 | 14 | @interface Demo1ViewController() 15 | 16 | @property (nonatomic , strong) UICollectionView *collectionView; 17 | 18 | @end 19 | 20 | @implementation Demo1ViewController 21 | 22 | - (void)viewDidLoad{ 23 | [super viewDidLoad]; 24 | [self initView]; 25 | } 26 | 27 | - (void)initView{ 28 | [super initView]; 29 | 30 | UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; 31 | flowLayout.itemSize = CGSizeMake(SCREEN_WIDTH/2-10, SCREEN_WIDTH/2-10); 32 | flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical; 33 | flowLayout.minimumLineSpacing = 20;//设置每个item之间的间距 34 | 35 | UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.navBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-self.navBarHeight) collectionViewLayout:flowLayout]; 36 | collectionView.delegate = self; 37 | collectionView.dataSource = self; 38 | collectionView.showsVerticalScrollIndicator = YES; 39 | collectionView.backgroundColor = [UIColor blackColor]; 40 | [self.view addSubview:collectionView]; 41 | 42 | _collectionView=collectionView; 43 | 44 | [self.collectionView registerClass:[Demo1Cell class] forCellWithReuseIdentifier:Demo1CellID]; 45 | } 46 | 47 | #pragma mark- UICollectionViewDataSource 48 | -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ 49 | return 1; 50 | } 51 | 52 | -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 53 | return 31; 54 | } 55 | 56 | -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 57 | Demo1Cell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:Demo1CellID forIndexPath:indexPath]; 58 | if(!cell){ 59 | cell = [[Demo1Cell alloc] init]; 60 | } 61 | [cell setImageName:[NSString stringWithFormat:@"%zi",indexPath.row] content:[NSString stringWithFormat:@"{%zi,%zi}",indexPath.section,indexPath.row]]; 62 | return cell; 63 | } 64 | 65 | 66 | -(NSString *)controllerTitle{ 67 | return @"网格视图"; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo2/Demo2ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo2ViewController.h 3 | // YXUICollectionViewDemo 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface Demo2ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo2/Demo2ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo2ViewController.m 3 | // YXUICollectionViewDemo 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo2ViewController.h" 10 | #import "YYCell.h" 11 | #import "YYNews.h" 12 | 13 | #define YYIDCell @"cell" 14 | #define YYMaxSections 100 15 | 16 | @interface Demo2ViewController() 17 | 18 | @property (nonatomic , strong) UICollectionView *collectionView; 19 | @property (nonatomic , strong) UIPageControl *pageControl; 20 | @property (nonatomic , strong) NSMutableArray *newses; 21 | @property (nonatomic , strong) NSTimer *timer; 22 | 23 | @end 24 | 25 | @implementation Demo2ViewController 26 | 27 | -(NSArray *)newses{ 28 | if (_newses == nil) { 29 | NSBundle *bundle = [NSBundle mainBundle]; 30 | NSString *path =[bundle pathForResource:@"resource.plist" ofType:nil]; 31 | NSArray *array = [NSArray arrayWithContentsOfFile:path]; 32 | 33 | _newses=[NSMutableArray array]; 34 | 35 | for (NSDictionary *dict in array) { 36 | [_newses addObject: [YYNews newsWithDict:dict]]; 37 | } 38 | 39 | } 40 | 41 | return _newses; 42 | } 43 | 44 | - (void)viewDidLoad{ 45 | [super viewDidLoad]; 46 | [self initView]; 47 | } 48 | 49 | - (void)initView{ 50 | [super initView]; 51 | 52 | UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; 53 | flowLayout.itemSize = CGSizeMake(SCREEN_WIDTH, 200); 54 | flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; 55 | flowLayout.minimumLineSpacing = 0; 56 | 57 | UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.navBarHeight, SCREEN_WIDTH, 200) collectionViewLayout:flowLayout]; 58 | collectionView.delegate = self; 59 | collectionView.dataSource = self; 60 | collectionView.showsHorizontalScrollIndicator = NO; 61 | collectionView.pagingEnabled = YES; 62 | collectionView.backgroundColor = [UIColor clearColor]; 63 | [self.view addSubview:collectionView]; 64 | 65 | _collectionView=collectionView; 66 | 67 | [self.collectionView registerClass:[YYCell class] forCellWithReuseIdentifier:YYIDCell]; 68 | 69 | [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:YYMaxSections/2] atScrollPosition:UICollectionViewScrollPositionLeft animated:YES]; 70 | 71 | UIPageControl *pageControl = [[UIPageControl alloc] init]; 72 | pageControl.center = CGPointMake(SCREEN_WIDTH*0.5, 160+self.navBarHeight); 73 | pageControl.bounds = CGRectMake(0, 0, 150, 40); 74 | pageControl.pageIndicatorTintColor = [UIColor blueColor]; 75 | pageControl.currentPageIndicatorTintColor = [UIColor redColor]; 76 | pageControl.enabled = NO; 77 | pageControl.numberOfPages = _newses.count; 78 | 79 | [self.view addSubview:pageControl]; 80 | 81 | _pageControl=pageControl; 82 | 83 | 84 | [self addTimer]; 85 | 86 | } 87 | 88 | #pragma mark 添加定时器 89 | -(void) addTimer{ 90 | NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(nextpage) userInfo:nil repeats:YES]; 91 | [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; 92 | self.timer = timer ; 93 | 94 | } 95 | 96 | #pragma mark 删除定时器 97 | -(void) removeTimer{ 98 | [self.timer invalidate]; 99 | self.timer = nil; 100 | } 101 | 102 | -(void) nextpage{ 103 | NSIndexPath *currentIndexPath = [[self.collectionView indexPathsForVisibleItems] lastObject]; 104 | 105 | NSIndexPath *currentIndexPathReset = [NSIndexPath indexPathForItem:currentIndexPath.item inSection:YYMaxSections/2]; 106 | [self.collectionView scrollToItemAtIndexPath:currentIndexPathReset atScrollPosition:UICollectionViewScrollPositionLeft animated:NO]; 107 | 108 | NSInteger nextItem = currentIndexPathReset.item +1; 109 | NSInteger nextSection = currentIndexPathReset.section; 110 | if (nextItem==self.newses.count) { 111 | nextItem=0; 112 | nextSection++; 113 | } 114 | NSIndexPath *nextIndexPath = [NSIndexPath indexPathForItem:nextItem inSection:nextSection]; 115 | 116 | [self.collectionView scrollToItemAtIndexPath:nextIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:YES]; 117 | } 118 | 119 | #pragma mark- UICollectionViewDataSource 120 | -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ 121 | return YYMaxSections; 122 | } 123 | 124 | -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 125 | return self.newses.count; 126 | } 127 | 128 | -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 129 | 130 | 131 | YYCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:YYIDCell forIndexPath:indexPath]; 132 | if(!cell){ 133 | cell = [[YYCell alloc] init]; 134 | } 135 | cell.news=self.newses[indexPath.item]; 136 | return cell; 137 | } 138 | 139 | 140 | -(void) scrollViewWillBeginDragging:(UIScrollView *)scrollView{ 141 | [self removeTimer]; 142 | } 143 | 144 | #pragma mark 当用户停止的时候调用 145 | -(void) scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ 146 | [self addTimer]; 147 | 148 | } 149 | 150 | #pragma mark 设置页码 151 | -(void) scrollViewDidScroll:(UIScrollView *)scrollView{ 152 | int page = (int) (scrollView.contentOffset.x/scrollView.frame.size.width+0.5)%self.newses.count; 153 | self.pageControl.currentPage =page; 154 | } 155 | 156 | -(NSString *)controllerTitle{ 157 | return @"无限轮播"; 158 | } 159 | 160 | @end 161 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo2/YYCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // YYCell.h 3 | // 图片轮播(无限循环) 4 | // 5 | // Created by yixiang on 14/12/12. 6 | // Copyright (c) 2014年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | @class YYNews; 11 | 12 | 13 | @interface YYCell : UICollectionViewCell 14 | @property (nonatomic, strong) YYNews *news; 15 | @end 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo2/YYCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // YYCell.m 3 | // 图片轮播(无限循环) 4 | // 5 | // Created by yixiang on 14/12/12. 6 | // Copyright (c) 2014年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "YYCell.h" 10 | #import "YYNews.h" 11 | 12 | @interface YYCell() 13 | @property (weak , nonatomic) UILabel *label; 14 | @property (weak , nonatomic) UIImageView *imageView; 15 | @end 16 | @implementation YYCell 17 | 18 | -(instancetype)initWithFrame:(CGRect)frame{ 19 | self =[super initWithFrame:frame]; 20 | if (self) { 21 | UIImageView *img = [[UIImageView alloc] init]; 22 | [self.contentView addSubview:img]; 23 | self.imageView = img; 24 | 25 | UILabel *lab = [[UILabel alloc] init]; 26 | [self.contentView addSubview:lab]; 27 | self.label = lab; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | 34 | -(void)setNews:(YYNews *)news 35 | { 36 | _news=news; 37 | 38 | [self settingData]; 39 | [self settingFrame]; 40 | } 41 | 42 | #pragma mark 给子控件赋值 43 | -(void) settingData{ 44 | self.imageView.image = [UIImage imageNamed:_news.icon]; 45 | self.label.text = _news.title; 46 | 47 | } 48 | 49 | #pragma mark 设置子控件的frame 50 | -(void) settingFrame{ 51 | CGFloat screenWidth = self.contentView.frame.size.width; 52 | self.imageView.frame = CGRectMake(0, 0, screenWidth, 200); 53 | self.label.frame = CGRectMake(0, 0, screenWidth, 200); 54 | self.label.font = [UIFont systemFontOfSize:30]; 55 | self.label.textAlignment = NSTextAlignmentCenter; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo2/YYNews.h: -------------------------------------------------------------------------------- 1 | // 2 | // YYNews.h 3 | // 图片轮播(无限循环) 4 | // 5 | // Created by yixiang on 14/12/12. 6 | // Copyright (c) 2014年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YYNews : NSObject 12 | @property (nonatomic, copy) NSString *title; 13 | @property (nonatomic, copy) NSString *icon; 14 | 15 | -(id)initWithDict:(NSDictionary *)dict; 16 | +(id)newsWithDict : (NSDictionary *) dict; 17 | @end 18 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo2/YYNews.m: -------------------------------------------------------------------------------- 1 | // 2 | // YYNews.m 3 | // 图片轮播(无限循环) 4 | // 5 | // Created by yixiang on 14/12/12. 6 | // Copyright (c) 2014年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "YYNews.h" 10 | 11 | @implementation YYNews 12 | 13 | -(id)initWithDict:(NSDictionary *)dict{ 14 | 15 | if (self=[super init]) { 16 | self.title = dict[@"title"]; 17 | self.icon = dict[@"icon"]; 18 | } 19 | return self; 20 | } 21 | 22 | +(id)newsWithDict:(NSDictionary *)dict{ 23 | return [[self alloc] initWithDict:dict]; 24 | } 25 | @end 26 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo3/Demo3Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo3Cell.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/12. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Demo3Cell : UICollectionViewCell 12 | 13 | @property (nonatomic , strong) NSString *imageName; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo3/Demo3Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo3Cell.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/12. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo3Cell.h" 10 | 11 | @interface Demo3Cell() 12 | 13 | @property (nonatomic , strong) UIImageView *imageShow; 14 | 15 | @end 16 | 17 | @implementation Demo3Cell 18 | 19 | -(instancetype)initWithFrame:(CGRect)frame{ 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | _imageShow = [[UIImageView alloc] initWithFrame:CGRectZero]; 23 | [self.contentView addSubview:_imageShow]; 24 | } 25 | return self; 26 | } 27 | 28 | - (void)layoutSubviews{ 29 | [super layoutSubviews]; 30 | _imageShow.frame = self.contentView.bounds; 31 | } 32 | 33 | -(void)setImageName:(NSString *)imageName{ 34 | _imageShow.image = [UIImage imageNamed:imageName]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo3/Demo3HeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo3HeaderView.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/15. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Demo3HeaderView : UICollectionReusableView 12 | 13 | @property (nonatomic , strong) NSString *title; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo3/Demo3HeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo3HeaderView.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/15. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo3HeaderView.h" 10 | 11 | @interface Demo3HeaderView() 12 | 13 | @property (nonatomic , strong) UILabel *titleLabel; 14 | 15 | @end 16 | 17 | @implementation Demo3HeaderView 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame{ 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 23 | _titleLabel.backgroundColor = [UIColor blackColor]; 24 | _titleLabel.alpha = 0.5; 25 | _titleLabel.textColor = [UIColor whiteColor]; 26 | [self addSubview:_titleLabel]; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)layoutSubviews{ 32 | _titleLabel.frame = self.bounds; 33 | } 34 | 35 | - (void)setTitle:(NSString *)title{ 36 | _titleLabel.text = title; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo3/Demo3ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo3ViewController.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/11. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface Demo3ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo3/Demo3ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo3ViewController.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/11. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo3ViewController.h" 10 | #import "Demo3Cell.h" 11 | #import "DDCollectionViewFlowLayout.h" 12 | #import "Demo3HeaderView.h" 13 | 14 | @interface Demo3ViewController () 15 | 16 | @property (nonatomic , strong) UICollectionView *collectionView; 17 | @end 18 | 19 | @implementation Demo3ViewController{ 20 | NSMutableDictionary *dataDict; 21 | NSArray *sortedArray; 22 | } 23 | 24 | - (void)viewDidLoad{ 25 | [super viewDidLoad]; 26 | 27 | [self initData]; 28 | 29 | [self initView]; 30 | 31 | } 32 | 33 | - (void)initData{ 34 | if(!dataDict) 35 | dataDict = [NSMutableDictionary new]; 36 | for (int i=0; i<32; i++) { 37 | NSMutableArray *picArray = [NSMutableArray array]; 38 | for (int j=0; j<10; j++) { 39 | [picArray addObject:[NSString stringWithFormat:@"%zi.JPG",i]]; 40 | } 41 | [dataDict setObject:picArray forKey:[NSString stringWithFormat:@"标题%zi",i+10]]; 42 | } 43 | //[self.collectionView reloadData]; 44 | } 45 | 46 | - (void)initView{ 47 | [super initView]; 48 | 49 | DDCollectionViewFlowLayout *layout = [[DDCollectionViewFlowLayout alloc] init]; 50 | layout.delegate = self; 51 | layout.enableStickyHeaders = YES; 52 | 53 | 54 | UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.navBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-self.navBarHeight) collectionViewLayout:layout]; 55 | NSLog(@"%@",NSStringFromCGRect(collectionView.frame)); 56 | collectionView.delegate = self; 57 | collectionView.dataSource = self; 58 | collectionView.backgroundColor = [UIColor clearColor]; 59 | [self.view addSubview:collectionView]; 60 | 61 | _collectionView=collectionView; 62 | 63 | [self.collectionView registerClass:[Demo3Cell class] forCellWithReuseIdentifier:@"Demo3Cell"]; 64 | [self.collectionView registerClass:[Demo3HeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"Demo3Header"]; 65 | } 66 | 67 | #pragma mark - UICollectionView DataSource Methods 68 | 69 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { 70 | return [[dataDict allKeys] count]; 71 | } 72 | 73 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 74 | sortedArray = [[dataDict allKeys] sortedArrayUsingSelector:@selector(compare:)]; 75 | return [dataDict[sortedArray[section]] count]; 76 | } 77 | 78 | - (NSInteger)collectionView:(UICollectionView *)collectionView layout:(DDCollectionViewFlowLayout *)layout numberOfColumnsInSection:(NSInteger)section{ 79 | return 4; 80 | } 81 | 82 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 83 | Demo3Cell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Demo3Cell" forIndexPath:indexPath]; 84 | NSString *imageName = dataDict[sortedArray[indexPath.section]][indexPath.row]; 85 | cell.imageName = imageName; 86 | return cell; 87 | } 88 | 89 | - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ 90 | if(kind == UICollectionElementKindSectionHeader){ 91 | Demo3HeaderView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"Demo3Header" forIndexPath:indexPath]; 92 | //header.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.5f]; 93 | header.title = sortedArray[indexPath.section]; 94 | return header; 95 | } 96 | return nil; 97 | } 98 | 99 | #pragma mark - UICollectionView Delegate Methods 100 | 101 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{ 102 | return 1; 103 | } 104 | 105 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{ 106 | return 1; 107 | } 108 | 109 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ 110 | return UIEdgeInsetsMake(1, 1, 1, 1); 111 | } 112 | 113 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ 114 | return CGSizeMake(80, 80); 115 | } 116 | 117 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{ 118 | return CGSizeMake(self.view.bounds.size.width, 30); 119 | } 120 | 121 | 122 | -(NSString *)controllerTitle{ 123 | return @"照片墙"; 124 | } 125 | 126 | @end 127 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo4/Demo4ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo4ViewController.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/15. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface Demo4ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo4/Demo4ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo4ViewController.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/15. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo4ViewController.h" 10 | #import "DDCollectionViewFlowLayout.h" 11 | #import "WaterfallCell.h" 12 | 13 | @interface Demo4ViewController () 14 | 15 | @property (nonatomic ,strong) UICollectionView *collectionView; 16 | 17 | @end 18 | 19 | @implementation Demo4ViewController{ 20 | NSMutableArray *dataList; 21 | NSMutableArray *sectionOne; 22 | //存储所有的高度的数组 23 | NSMutableArray *heightArr; 24 | } 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | [self initData]; 29 | [self initView]; 30 | } 31 | 32 | - (void)initData{ 33 | if(!dataList) 34 | dataList = [[NSMutableArray alloc] initWithCapacity:0]; 35 | [dataList removeAllObjects]; 36 | 37 | if (!heightArr) { 38 | heightArr = [[NSMutableArray alloc] initWithCapacity:0]; 39 | } 40 | [heightArr removeAllObjects]; 41 | 42 | for (int i=0; i<32; i++) { 43 | [dataList addObject:[NSString stringWithFormat:@"%zi.JPG",i]]; 44 | CGFloat height = 100 + (arc4random()%100); 45 | [heightArr addObject:[NSString stringWithFormat:@"%f",height]]; 46 | } 47 | } 48 | 49 | - (void)initView{ 50 | [super initView]; 51 | 52 | DDCollectionViewFlowLayout *layout = [[DDCollectionViewFlowLayout alloc] init]; 53 | layout.delegate = self; 54 | 55 | UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.navBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-self.navBarHeight) collectionViewLayout:layout]; 56 | collectionView.delegate = self; 57 | collectionView.dataSource = self; 58 | collectionView.backgroundColor = [UIColor clearColor]; 59 | [self.view addSubview:collectionView]; 60 | 61 | _collectionView=collectionView; 62 | 63 | [self.collectionView registerClass:[WaterfallCell class] forCellWithReuseIdentifier:@"WaterfallCell"]; 64 | 65 | 66 | } 67 | 68 | 69 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { 70 | return 1; 71 | } 72 | 73 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 74 | return dataList.count; 75 | } 76 | 77 | - (NSInteger)collectionView:(UICollectionView *)collectionView layout:(DDCollectionViewFlowLayout *)layout numberOfColumnsInSection:(NSInteger)section{ 78 | return 3; 79 | } 80 | 81 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 82 | WaterfallCell *cell = (WaterfallCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"WaterfallCell" forIndexPath:indexPath]; 83 | cell.imageName = dataList[indexPath.row]; 84 | return cell; 85 | } 86 | 87 | #pragma mark - UICollectionView Delegate Methods 88 | 89 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{ 90 | return 5; 91 | } 92 | 93 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{ 94 | return 5; 95 | } 96 | 97 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ 98 | return UIEdgeInsetsMake(5, 5, 5, 5); 99 | } 100 | 101 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ 102 | //return CGSizeMake(100, 100 + indexPath.item *10); 103 | CGFloat height = [[heightArr objectAtIndex:indexPath.row] floatValue]; 104 | return CGSizeMake(100, height); 105 | } 106 | 107 | 108 | - (NSString*)controllerTitle{ 109 | return @"瀑布流"; 110 | } 111 | 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo4/WaterfallCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // WaterfallCell.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/15. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WaterfallCell : UICollectionViewCell 12 | 13 | @property (nonatomic , strong) NSString *imageName; 14 | @end 15 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo4/WaterfallCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // WaterfallCell.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/15. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "WaterfallCell.h" 10 | 11 | @interface WaterfallCell() 12 | @property (nonatomic , strong) UIImageView *imageShow; 13 | @end 14 | 15 | @implementation WaterfallCell 16 | 17 | -(instancetype)initWithFrame:(CGRect)frame{ 18 | self = [super initWithFrame:frame]; 19 | if (self) { 20 | _imageShow = [[UIImageView alloc] initWithFrame:CGRectZero]; 21 | [self.contentView addSubview:_imageShow]; 22 | } 23 | return self; 24 | } 25 | 26 | - (void)layoutSubviews{ 27 | [super layoutSubviews]; 28 | _imageShow.frame = self.contentView.bounds; 29 | } 30 | 31 | -(void)setImageName:(NSString *)imageName{ 32 | _imageShow.image = [UIImage imageNamed:imageName]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/Demo5Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo5Cell.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Demo5Cell : UICollectionViewCell 12 | 13 | @property (nonatomic , strong) NSString *title; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/Demo5Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo5Cell.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo5Cell.h" 10 | 11 | @interface Demo5Cell() 12 | 13 | @property (nonatomic , strong) UILabel *titleLabel; 14 | 15 | @end 16 | 17 | @implementation Demo5Cell 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame{ 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 23 | _titleLabel.font = [UIFont systemFontOfSize:18]; 24 | [self.contentView addSubview:_titleLabel]; 25 | 26 | } 27 | return self; 28 | } 29 | 30 | - (void)layoutSubviews{ 31 | [super layoutSubviews]; 32 | _titleLabel.frame = CGRectMake(CGRectGetWidth(self.contentView.frame)/2-100, CGRectGetHeight(self.contentView.frame)/2-10, 200, 20); 33 | } 34 | 35 | - (void)setTitle:(NSString *)title{ 36 | _titleLabel.text = title; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/Demo5HeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo5HeaderView.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Demo5HeaderView : UICollectionReusableView 12 | 13 | @property (nonatomic , strong) NSString *iconName; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/Demo5HeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo5HeaderView.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo5HeaderView.h" 10 | 11 | @interface Demo5HeaderView() 12 | 13 | @property (nonatomic , strong) UIImageView *iconView; 14 | 15 | @end 16 | 17 | @implementation Demo5HeaderView 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame{ 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | _iconView = [[UIImageView alloc] initWithFrame:CGRectZero]; 23 | [self addSubview:_iconView]; 24 | } 25 | return self; 26 | } 27 | 28 | - (void)layoutSubviews{ 29 | [super layoutSubviews]; 30 | _iconView.frame = self.bounds; 31 | } 32 | 33 | - (void)setIconName:(NSString *)iconName{ 34 | _iconView.image = [UIImage imageNamed:iconName]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/Demo5ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo5ViewController.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface Demo5ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/Demo5ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo5ViewController.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo5ViewController.h" 10 | #import "StretchyHeaderCollectionViewLayout.h" 11 | #import "Demo5Cell.h" 12 | #import "Demo5HeaderView.h" 13 | 14 | NSString * const kCellId = @"Cell"; 15 | NSString * const kHeaderId = @"Header"; 16 | 17 | @interface Demo5ViewController () 18 | 19 | @property (nonatomic , strong) UICollectionView *collectionView; 20 | 21 | @end 22 | 23 | @implementation Demo5ViewController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | [self initView]; 28 | } 29 | 30 | - (void)initView{ 31 | [super initView]; 32 | 33 | StretchyHeaderCollectionViewLayout *stretchyLayout = [[StretchyHeaderCollectionViewLayout alloc] init]; 34 | //stretchyLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); 35 | stretchyLayout.itemSize = CGSizeMake(SCREEN_WIDTH, 40); 36 | stretchyLayout.headerReferenceSize = CGSizeMake(SCREEN_WIDTH, 240); 37 | 38 | _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.navBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-self.navBarHeight) collectionViewLayout:stretchyLayout]; 39 | _collectionView.backgroundColor = [UIColor clearColor]; 40 | _collectionView.alwaysBounceVertical = YES; 41 | _collectionView.showsVerticalScrollIndicator = NO; 42 | _collectionView.dataSource = self; 43 | _collectionView.delegate = self; 44 | 45 | [self.view addSubview:_collectionView]; 46 | 47 | [_collectionView registerClass:[Demo5Cell class] forCellWithReuseIdentifier:kCellId]; 48 | [_collectionView registerClass:[Demo5HeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:kHeaderId]; 49 | 50 | } 51 | 52 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ 53 | return 1; 54 | } 55 | 56 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 57 | return 20; 58 | } 59 | 60 | - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ 61 | if (kind == UICollectionElementKindSectionHeader) { 62 | Demo5HeaderView *headView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:kHeaderId forIndexPath:indexPath]; 63 | headView.iconName = [NSString stringWithFormat:@"%zi.JPG",2]; 64 | return headView; 65 | } 66 | return nil; 67 | } 68 | 69 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 70 | Demo5Cell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCellId forIndexPath:indexPath]; 71 | cell.title = [NSString stringWithFormat:@"我是景铭%zi",indexPath.row]; 72 | 73 | return cell; 74 | } 75 | 76 | - (NSString *)controllerTitle{ 77 | return @"头部拉伸效果"; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/StretchyHeaderCollectionViewLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // StretchyHeaderCollectionViewLayout.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StretchyHeaderCollectionViewLayout : UICollectionViewFlowLayout 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo5/StretchyHeaderCollectionViewLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // StretchyHeaderCollectionViewLayout.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/19. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "StretchyHeaderCollectionViewLayout.h" 10 | 11 | @implementation StretchyHeaderCollectionViewLayout 12 | 13 | - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds{ 14 | return YES; 15 | } 16 | 17 | - (UICollectionViewScrollDirection)scrollDirection{ 18 | return UICollectionViewScrollDirectionVertical; 19 | } 20 | 21 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{ 22 | UICollectionView *collectionView = [self collectionView]; 23 | CGPoint offset = [collectionView contentOffset]; 24 | 25 | NSArray *attributes = [super layoutAttributesForElementsInRect:rect]; 26 | 27 | if (offset.y<0) { 28 | CGFloat deltaY = fabs(offset.y); 29 | for (UICollectionViewLayoutAttributes *attrs in attributes ) { 30 | NSString *kind = [attrs representedElementKind]; 31 | if (kind == UICollectionElementKindSectionHeader) { 32 | CGSize headerSize = [self headerReferenceSize]; 33 | CGRect headRect = [attrs frame]; 34 | headRect.size.height = headerSize.height+deltaY; 35 | headRect.size.width = headerSize.width +deltaY; 36 | headRect.origin.y = headRect.origin.y - deltaY; 37 | headRect.origin.x = headRect.origin.x - deltaY/2; 38 | [attrs setFrame:headRect]; 39 | break; 40 | } 41 | } 42 | 43 | } 44 | 45 | return attributes; 46 | } 47 | 48 | //- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{ 49 | // UICollectionView *collectionView = [self collectionView]; 50 | // UIEdgeInsets insets = [collectionView contentInset]; 51 | // CGPoint offset = [collectionView contentOffset]; 52 | // CGFloat minY = -insets.top; 53 | // 54 | // NSArray *attributes = [super layoutAttributesForElementsInRect:rect]; 55 | // 56 | // if (offset.y 10 | 11 | @interface Demo6Cell : UICollectionViewCell 12 | 13 | @property (nonatomic , strong) NSString *imageName; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo6/Demo6Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo6Cell.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/21. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo6Cell.h" 10 | 11 | @interface Demo6Cell() 12 | @property (nonatomic , strong) UIImageView *imageShow; 13 | @end 14 | 15 | @implementation Demo6Cell 16 | 17 | -(instancetype)initWithFrame:(CGRect)frame{ 18 | self = [super initWithFrame:frame]; 19 | if (self) { 20 | _imageShow = [[UIImageView alloc] initWithFrame:CGRectZero]; 21 | _imageShow.clipsToBounds = YES; 22 | [self.contentView addSubview:_imageShow]; 23 | } 24 | return self; 25 | } 26 | 27 | - (void)layoutSubviews{ 28 | [super layoutSubviews]; 29 | CGRect rect = self.contentView.bounds; 30 | rect.origin.x = rect.origin.x - 20; 31 | rect.size.width = rect.size.width+40; 32 | _imageShow.frame = rect; 33 | } 34 | 35 | -(void)setImageName:(NSString *)imageName{ 36 | _imageShow.image = [UIImage imageNamed:imageName]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo6/Demo6ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo6ViewController.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/21. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface Demo6ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo6/Demo6ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo6ViewController.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/21. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo6ViewController.h" 10 | #import "TiltedLayout.h" 11 | #import "Demo6Cell.h" 12 | 13 | #define Demo6CellId @"demo6cellid" 14 | 15 | @interface Demo6ViewController () 16 | 17 | @property (nonatomic , strong) UICollectionView *collectionView; 18 | 19 | @end 20 | 21 | @implementation Demo6ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | [self initView]; 26 | } 27 | 28 | - (void)initView{ 29 | [super initView]; 30 | 31 | TiltedLayout *tiltedLayout = [[TiltedLayout alloc] init]; 32 | tiltedLayout.itemSize = CGSizeMake(SCREEN_WIDTH, 130); 33 | tiltedLayout.minimumLineSpacing = 15; 34 | 35 | _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.navBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-self.navBarHeight) collectionViewLayout:tiltedLayout]; 36 | _collectionView.backgroundColor = [UIColor clearColor]; 37 | _collectionView.dataSource = self; 38 | _collectionView.delegate = self; 39 | _collectionView.contentInset = UIEdgeInsetsMake(38, 0, 38, 0); 40 | [self.view addSubview:_collectionView]; 41 | 42 | [_collectionView registerClass:[Demo6Cell class] forCellWithReuseIdentifier:Demo6CellId]; 43 | 44 | } 45 | 46 | 47 | 48 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 49 | return 20; 50 | } 51 | 52 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 53 | Demo6Cell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:Demo6CellId forIndexPath:indexPath]; 54 | cell.imageName = [NSString stringWithFormat:@"%zi.JPG",indexPath.row]; 55 | 56 | return cell; 57 | } 58 | 59 | - (NSString *)controllerTitle{ 60 | return @"倾斜的Cell"; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo6/TiltedLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // TiltedLayout.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/21. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TiltedLayout : UICollectionViewFlowLayout 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo6/TiltedLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // TiltedLayout.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/21. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "TiltedLayout.h" 10 | 11 | @implementation TiltedLayout 12 | 13 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{ 14 | NSArray *attributes = [super layoutAttributesForElementsInRect:rect]; 15 | for (UICollectionViewLayoutAttributes *attr in attributes ) { 16 | CGFloat degrees = M_PI * (-14.0f/180.0f); 17 | attr.transform = CGAffineTransformMakeRotation(degrees); 18 | } 19 | return attributes; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo7/Demo7ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Demo7ViewController.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/11/6. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface Demo7ViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo7/Demo7ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Demo7ViewController.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/11/6. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Demo7ViewController.h" 10 | #import "RPSlidingMenuCell.h" 11 | #import "RPSlidingMenuLayout.h" 12 | 13 | #define Demo7CellId @"demo6cellid" 14 | 15 | @interface Demo7ViewController () 16 | 17 | @property (nonatomic , strong) UICollectionView *collectionView; 18 | 19 | @end 20 | 21 | @implementation Demo7ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | [self initView]; 26 | 27 | } 28 | 29 | - (void)initView{ 30 | [super initView]; 31 | 32 | RPSlidingMenuLayout *layout = [[RPSlidingMenuLayout alloc] initWithDelegate:nil]; 33 | 34 | _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0,self.navBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-self.navBarHeight) collectionViewLayout:layout]; 35 | _collectionView.dataSource = self; 36 | _collectionView.delegate = self; 37 | [self.view addSubview:_collectionView]; 38 | 39 | [_collectionView registerClass:[RPSlidingMenuCell class] forCellWithReuseIdentifier:Demo7CellId]; 40 | } 41 | 42 | 43 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 44 | return 31; 45 | } 46 | 47 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 48 | RPSlidingMenuCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:Demo7CellId forIndexPath:indexPath]; 49 | cell.textLabel.text = [NSString stringWithFormat:@"风景%zi",indexPath.row]; 50 | cell.detailTextLabel.text = [NSString stringWithFormat:@"风景简介风景简介风景简介%zi",indexPath.row]; 51 | cell.backgroundImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%zi.JPG",indexPath.row]]; 52 | 53 | return cell; 54 | } 55 | 56 | - (NSString *)controllerTitle{ 57 | return @"顶部cellheight逐步增大"; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo7/RPSlidingMenuCell.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Robots and Pencils Inc. 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | #import 25 | /** 26 | The height of a RPSlidingCell when it is at it's full feature height. 27 | */ 28 | extern const CGFloat RPSlidingCellFeatureHeight; 29 | 30 | /** 31 | The height of a RPSlidingCell when it is at it's normal height. 32 | */ 33 | extern const CGFloat RPSlidingCellCollapsedHeight; 34 | 35 | /** 36 | RPSlidingMenu is a subclass of UICollectionViewCell that is used for displaying rows in a RPSlidingMenuViewController. It has a textLabel that can be set to show a header title for the cell. It also has a detailTextLabel where a longer description can follow the textLabel header. The backgroundImageView allows an image to be set behind it. This cell has text that fades and shrink as it goes from feature height to normal height 37 | */ 38 | @interface RPSlidingMenuCell : UICollectionViewCell 39 | 40 | /** 41 | The topmost centered label that is used like a header for the cell. The label grows as it approaches feature height 42 | */ 43 | @property (strong, nonatomic) UILabel *textLabel; 44 | 45 | /** 46 | The bottommost centered label that is used for a description for the cell. The label fades in as it approaches feature height 47 | */ 48 | @property (strong, nonatomic) UILabel *detailTextLabel; 49 | 50 | /** 51 | The background image view of the cell. Set this to supply an image that is centered in the cell. It is covered by a black view that has varying alpha depending on the cell size. 52 | */ 53 | @property (strong, nonatomic) UIImageView *backgroundImageView; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo7/RPSlidingMenuCell.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Robots and Pencils Inc. 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import "RPSlidingMenuCell.h" 26 | 27 | const CGFloat RPSlidingCellFeatureHeight = 240.0f; 28 | const CGFloat RPSlidingCellCollapsedHeight = 88.0f; 29 | const CGFloat RPSlidingCellDetailTextPadding = 20.0f; 30 | const CGFloat RPSlidingMenuNormalImageCoverAlpha = 0.5f; 31 | const CGFloat RPSlidingMenuFeaturedImageCoverAlpha = 0.2f; 32 | 33 | @interface RPSlidingMenuCell () 34 | 35 | @property (strong, nonatomic) UIView *imageCover; 36 | 37 | @end 38 | 39 | @implementation RPSlidingMenuCell 40 | 41 | - (id)initWithFrame:(CGRect)frame { 42 | 43 | self = [super initWithFrame:frame]; 44 | if (self) { 45 | self.clipsToBounds = YES; 46 | [self setupTextLabel]; 47 | [self setupDetailTextLabel]; 48 | [self setupImageView]; 49 | } 50 | 51 | return self; 52 | } 53 | 54 | 55 | #pragma - mark label and image view setups 56 | 57 | // We do this in code so there is no resources to bundle up 58 | 59 | - (void)setupTextLabel { 60 | 61 | CGRect screenRect = [[UIScreen mainScreen] bounds]; 62 | self.textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, screenRect.size.width, self.contentView.frame.size.height)]; 63 | self.textLabel.center = self.contentView.center; 64 | self.textLabel.font = [UIFont boldSystemFontOfSize:32.0]; 65 | self.textLabel.textColor = [UIColor whiteColor]; 66 | self.textLabel.textAlignment = NSTextAlignmentCenter; 67 | [self.contentView addSubview:self.textLabel]; 68 | } 69 | 70 | - (void)setupDetailTextLabel { 71 | 72 | NSAssert(self.textLabel != nil, @"the text label must be set up before this so it can use its frame"); 73 | 74 | CGRect screenRect = [[UIScreen mainScreen] bounds]; 75 | CGFloat startY = self.textLabel.frame.origin.y + self.textLabel.frame.size.height - 40.0f; 76 | self.detailTextLabel = [[UILabel alloc] initWithFrame:CGRectMake(RPSlidingCellDetailTextPadding, startY, screenRect.size.width - (RPSlidingCellDetailTextPadding * 2), self.contentView.frame.size.height - startY)]; 77 | self.detailTextLabel.lineBreakMode = NSLineBreakByWordWrapping; 78 | self.detailTextLabel.numberOfLines = 0; 79 | self.detailTextLabel.font = [UIFont boldSystemFontOfSize:12.0f]; 80 | self.detailTextLabel.textColor = [UIColor whiteColor]; 81 | self.detailTextLabel.textAlignment = NSTextAlignmentCenter; 82 | [self.contentView addSubview:self.detailTextLabel]; 83 | } 84 | 85 | - (void)setupImageView { 86 | 87 | CGRect screenRect = [[UIScreen mainScreen] bounds]; 88 | self.backgroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, screenRect.size.width, RPSlidingCellFeatureHeight)]; 89 | self.backgroundImageView.clipsToBounds = YES; 90 | self.backgroundImageView.center = self.contentView.center; 91 | self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill; 92 | self.backgroundImageView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 93 | 94 | // add a cover that we can fade in a black tint 95 | self.imageCover = [[UIView alloc] initWithFrame:self.backgroundImageView.frame]; 96 | self.imageCover.backgroundColor = [UIColor blackColor]; 97 | self.imageCover.alpha = 0.6f; 98 | self.imageCover.autoresizingMask = self.backgroundImageView.autoresizingMask; 99 | [self.backgroundImageView addSubview:self.imageCover]; 100 | [self.contentView insertSubview:self.backgroundImageView atIndex:0]; 101 | [self.contentView insertSubview:self.imageCover atIndex:1]; 102 | 103 | } 104 | 105 | 106 | - (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes { 107 | 108 | [super applyLayoutAttributes:layoutAttributes]; 109 | 110 | CGFloat featureNormaHeightDifference = RPSlidingCellFeatureHeight - RPSlidingCellCollapsedHeight; 111 | 112 | // how much its grown from normal to feature 113 | CGFloat amountGrown = RPSlidingCellFeatureHeight - self.frame.size.height; 114 | 115 | // percent of growth from normal to feature 116 | CGFloat percentOfGrowth = 1 - (amountGrown / featureNormaHeightDifference); 117 | 118 | //Curve the percent so that the animations move smoother 119 | percentOfGrowth = sin(percentOfGrowth * M_PI_2); 120 | 121 | CGFloat scaleAndAlpha = MAX(percentOfGrowth, 0.5f); 122 | 123 | // scale title as it collapses but keep origin x the same and the y location proportional to view height. Also fade in alpha 124 | self.textLabel.transform = CGAffineTransformMakeScale(scaleAndAlpha, scaleAndAlpha); 125 | self.textLabel.center = self.contentView.center; 126 | 127 | // keep detail just under text label 128 | self.detailTextLabel.center = CGPointMake(self.center.x, self.textLabel.center.y + 40.0f); 129 | 130 | // its convenient to set the alpha of the fading controls to the percent of growth value 131 | self.detailTextLabel.alpha = percentOfGrowth; 132 | 133 | // when full size, alpha of imageCover should be 20%, when collapsed should be 90% 134 | self.imageCover.alpha = RPSlidingMenuNormalImageCoverAlpha - (percentOfGrowth * (RPSlidingMenuNormalImageCoverAlpha - RPSlidingMenuFeaturedImageCoverAlpha)); 135 | 136 | } 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo7/RPSlidingMenuLayout.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Robots and Pencils Inc. 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import 26 | 27 | @class RPSlidingMenuLayout; 28 | 29 | extern const CGFloat RPSlidingCellDragInterval; 30 | 31 | @protocol RPSlidingMenuLayoutDelegate 32 | 33 | - (CGFloat)heightForFeatureCell; 34 | - (CGFloat)heightForCollapsedCell; 35 | 36 | @end 37 | 38 | /** 39 | RPSlidingMenuLayout is a subclass of UICollectionViewLayout that is used to determine the current layout of the RPSlidingMenu. It calculates the frames necessary to make the sliding/growing cell effect. 40 | */ 41 | @interface RPSlidingMenuLayout : UICollectionViewLayout 42 | 43 | - (instancetype)initWithDelegate:(id)delegate; 44 | 45 | @property (nonatomic, assign) id delegate; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/Controller/Demo7/RPSlidingMenuLayout.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Robots and Pencils Inc. 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | #import 25 | 26 | const CGFloat RPSlidingCellDragInterval = 180.0f; 27 | 28 | #import "RPSlidingMenuLayout.h" 29 | #import "RPSlidingMenuCell.h" 30 | 31 | @interface RPSlidingMenuLayout () 32 | 33 | @property (strong, nonatomic) NSDictionary *layoutAttributes; 34 | 35 | @end 36 | 37 | @implementation RPSlidingMenuLayout 38 | 39 | - (instancetype)initWithDelegate:(id)delegate { 40 | 41 | self = [super init]; 42 | if (self){ 43 | _delegate = delegate; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | - (void)prepareLayout { 50 | 51 | [super prepareLayout]; 52 | 53 | CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width; 54 | 55 | NSInteger topFeatureIndex = [self currentCellIndex]; 56 | 57 | CGFloat topCellsInterpolation = [self currentCellIndex] - topFeatureIndex; 58 | 59 | NSMutableDictionary *layoutAttributes = [NSMutableDictionary dictionary]; 60 | NSIndexPath *indexPath; 61 | 62 | // last rect will be used to calculate frames past the first one. We initialize it to a non junk 0 value 63 | CGRect lastRect = CGRectMake(0.0f, 0.0f, screenWidth, RPSlidingCellCollapsedHeight); 64 | NSInteger numItems = [self.collectionView numberOfItemsInSection:0]; 65 | 66 | CGFloat featureHeight = [self featureHeight]; 67 | CGFloat normalHeight = [self collapsedHeight]; 68 | 69 | for (NSInteger itemIndex = 0; itemIndex < numItems; itemIndex++) { 70 | indexPath = [NSIndexPath indexPathForItem:itemIndex inSection:0]; 71 | 72 | UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; 73 | attributes.zIndex = itemIndex; 74 | NSInteger yValue = 0.0f; 75 | 76 | if (indexPath.row == topFeatureIndex) { 77 | // our top feature cell 78 | CGFloat yOffset = normalHeight *topCellsInterpolation; 79 | yValue = self.collectionView.contentOffset.y - yOffset; 80 | attributes.frame = CGRectMake(0.0f, yValue , screenWidth, featureHeight); 81 | } else if (indexPath.row == (topFeatureIndex + 1) && indexPath.row != numItems) { 82 | // the cell after the feature which grows into one as it goes up unless its the last cell (back to top) 83 | yValue = lastRect.origin.y + lastRect.size.height; 84 | CGFloat bottomYValue = yValue + normalHeight; 85 | CGFloat amountToGrow = MAX((featureHeight - normalHeight) *topCellsInterpolation, 0); 86 | NSInteger newHeight = normalHeight + amountToGrow; 87 | attributes.frame = CGRectMake(0.0f, bottomYValue - newHeight, screenWidth, newHeight); 88 | } else { 89 | // all other cells above or below those on screen 90 | yValue = lastRect.origin.y + lastRect.size.height; 91 | attributes.frame = CGRectMake(0.0f, yValue, screenWidth, normalHeight); 92 | } 93 | 94 | lastRect = attributes.frame; 95 | [layoutAttributes setObject:attributes forKey:indexPath]; 96 | } 97 | 98 | self.layoutAttributes = layoutAttributes; 99 | } 100 | 101 | - (CGFloat)currentCellIndex { 102 | return (self.collectionView.contentOffset.y / RPSlidingCellDragInterval); 103 | } 104 | 105 | - (CGFloat)featureHeight{ 106 | 107 | if (self.delegate && [self.delegate respondsToSelector:@selector(heightForFeatureCell)]){ 108 | return [self.delegate heightForFeatureCell]; 109 | }else{ 110 | return RPSlidingCellFeatureHeight; 111 | } 112 | } 113 | 114 | - (CGFloat)collapsedHeight{ 115 | 116 | if (self.delegate && [self.delegate respondsToSelector:@selector(heightForCollapsedCell)]){ 117 | return [self.delegate heightForCollapsedCell]; 118 | }else{ 119 | return RPSlidingCellCollapsedHeight; 120 | } 121 | } 122 | 123 | 124 | - (CGSize)collectionViewContentSize { 125 | 126 | NSInteger numberOfItems = [self.collectionView numberOfItemsInSection:0]; 127 | CGFloat height = (numberOfItems * RPSlidingCellDragInterval) + (self.collectionView.frame.size.height - RPSlidingCellDragInterval); 128 | return CGSizeMake(self.collectionView.frame.size.width, height); 129 | 130 | } 131 | 132 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { 133 | 134 | // create layouts for the rectangles in the view 135 | NSMutableArray *attributesInRect = [NSMutableArray array]; 136 | for (UICollectionViewLayoutAttributes *attributes in [self.layoutAttributes allValues]) { 137 | if(CGRectIntersectsRect(rect, attributes.frame)){ 138 | [attributesInRect addObject:attributes]; 139 | } 140 | } 141 | 142 | return attributesInRect; 143 | } 144 | 145 | 146 | - (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity { 147 | 148 | CGFloat proposedPageIndex = roundf(proposedContentOffset.y / RPSlidingCellDragInterval); 149 | CGFloat nearestPageOffset = proposedPageIndex * RPSlidingCellDragInterval; 150 | 151 | return CGPointMake(0.0f, nearestPageOffset); 152 | } 153 | 154 | - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath { 155 | return self.layoutAttributes[indexPath]; 156 | } 157 | 158 | // bounds change causes prepareLayout if YES 159 | - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { 160 | return YES; 161 | } 162 | 163 | @end 164 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/View/DDCollectionViewFlowLayout/DDCollectionViewFlowLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDCollectionViewFlowLayout.h 3 | // DDCollectionViewFlowLayout 4 | // 5 | // Created by Diaoshu on 15-2-12. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DDCollectionViewFlowLayout; 12 | 13 | @protocol DDCollectionViewDelegateFlowLayout 14 | 15 | @required 16 | /** 17 | * number of column in section protocol delegate methods 18 | * 19 | * @param collectionView collectionView 20 | * @param layout DDCollectionViewFlowLayout 21 | * @param sectionIndex section index 22 | * 23 | * @return number of column 24 | */ 25 | - (NSInteger)collectionView:(UICollectionView *)collectionView 26 | layout:(DDCollectionViewFlowLayout *)layout 27 | numberOfColumnsInSection:(NSInteger)section; 28 | 29 | @end 30 | 31 | 32 | @interface DDCollectionViewFlowLayout : UICollectionViewFlowLayout 33 | 34 | @property (nonatomic, weak) id delegate; 35 | 36 | @property (nonatomic) BOOL enableStickyHeaders; //Defalut is NO, set it's YES will sticky the section header. 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/CenterPage/View/DDCollectionViewFlowLayout/DDCollectionViewFlowLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // DDCollectionViewFlowLayout.m 3 | // DDCollectionViewFlowLayout 4 | // 5 | // Created by Diaoshu on 15-2-12. 6 | // Copyright (c) 2015年 DDKit. All rights reserved. 7 | // 8 | 9 | #import "DDCollectionViewFlowLayout.h" 10 | 11 | @interface DDCollectionViewFlowLayout(){ 12 | NSMutableArray *sectionRects; 13 | NSMutableArray *columnRectsInSection; 14 | 15 | NSMutableArray *layoutItemAttributes; 16 | NSDictionary *headerFooterItemAttributes; 17 | 18 | NSMutableArray *sectionInsetses; 19 | 20 | UIEdgeInsets currentEdgeInsets; 21 | } 22 | 23 | @end 24 | 25 | @implementation DDCollectionViewFlowLayout 26 | 27 | #pragma mark - UISubclassingHooks Category Methods 28 | 29 | - (CGSize)collectionViewContentSize { 30 | [super collectionViewContentSize]; 31 | 32 | CGRect lastSectionRect = [[sectionRects lastObject] CGRectValue]; 33 | CGSize lastSize = CGSizeMake(CGRectGetWidth(self.collectionView.bounds), CGRectGetMaxY(lastSectionRect)); 34 | return lastSize; 35 | } 36 | 37 | - (void)prepareLayout{ 38 | 39 | NSUInteger numberOfSections = self.collectionView.numberOfSections; 40 | sectionRects = [[NSMutableArray alloc] initWithCapacity:numberOfSections]; 41 | columnRectsInSection = [[NSMutableArray alloc] initWithCapacity:numberOfSections]; 42 | layoutItemAttributes = [[NSMutableArray alloc] initWithCapacity:numberOfSections]; 43 | sectionInsetses = [[NSMutableArray alloc] initWithCapacity:numberOfSections]; 44 | headerFooterItemAttributes = @{UICollectionElementKindSectionHeader:[NSMutableArray array], UICollectionElementKindSectionFooter:[NSMutableArray array]}; 45 | 46 | for (NSUInteger section = 0; section < numberOfSections; ++section) { 47 | NSUInteger itemsInSection = [self.collectionView numberOfItemsInSection:section]; 48 | [layoutItemAttributes addObject:[NSMutableArray array]]; 49 | [self prepareSectionLayout:section withNumberOfItems:itemsInSection]; 50 | } 51 | } 52 | 53 | //没什么用,并没有用到 54 | //- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind 55 | // atIndexPath:(NSIndexPath *)indexPath { 56 | // return headerFooterItemAttributes[kind][indexPath.section]; 57 | //} 58 | // 59 | //- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath{ 60 | // return layoutItemAttributes[indexPath.section][indexPath.item]; 61 | //} 62 | 63 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { 64 | CGRect visibleRect; 65 | visibleRect.origin.x = rect.origin.x; 66 | visibleRect.origin.y = rect.origin.y; 67 | visibleRect.size.width = rect.size.width; 68 | visibleRect.size.height = rect.size.height-60; 69 | NSLog(@"%@",NSStringFromCGRect(rect)); 70 | return [self searchVisibleLayoutAttributesInRect:visibleRect]; 71 | } 72 | 73 | - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds{ 74 | return YES; 75 | } 76 | 77 | #pragma mark - Private Methods 78 | 79 | - (void)prepareSectionLayout:(NSUInteger)section withNumberOfItems:(NSUInteger)numberOfItems{ 80 | UICollectionView *cView = self.collectionView; 81 | 82 | NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:section]; 83 | 84 | //# hanlde the section header 85 | CGFloat headerHeight = 0.0f; 86 | 87 | CGRect previousSectionRect = [self rectForSectionAtIndex:indexPath.section - 1]; 88 | CGRect sectionRect; 89 | sectionRect.origin.x = 0; 90 | sectionRect.origin.y = CGRectGetHeight(previousSectionRect) + CGRectGetMinY(previousSectionRect); 91 | sectionRect.size.width = cView.bounds.size.width; 92 | 93 | if([self.delegate respondsToSelector:@selector(collectionView:layout:referenceSizeForHeaderInSection:)]){ 94 | 95 | //# Define the rect of the header 96 | CGRect headerFrame; 97 | headerFrame.origin.x = 0.0f; 98 | headerFrame.origin.y = sectionRect.origin.y; 99 | 100 | CGSize headerSize = [self.delegate collectionView:self.collectionView layout:self referenceSizeForHeaderInSection:indexPath.section]; 101 | headerFrame.size.height = headerSize.height; 102 | headerFrame.size.width = headerSize.width; 103 | 104 | UICollectionViewLayoutAttributes *headerAttributes = 105 | [UICollectionViewLayoutAttributes 106 | layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader 107 | withIndexPath:indexPath]; 108 | headerAttributes.frame = headerFrame; 109 | 110 | headerHeight = headerFrame.size.height; 111 | [headerFooterItemAttributes[UICollectionElementKindSectionHeader] addObject:headerAttributes]; 112 | } 113 | 114 | //# get the insets of section 115 | UIEdgeInsets sectionInset = UIEdgeInsetsZero; 116 | 117 | if([self.delegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)]){ 118 | sectionInset = [self.delegate collectionView:cView layout:self insetForSectionAtIndex:section]; 119 | } 120 | 121 | [sectionInsetses addObject:[NSValue valueWithUIEdgeInsets:sectionInset]]; 122 | 123 | CGRect itemsContentRect; 124 | 125 | //# the the lineSpacing & interitemSpacing default values 126 | CGFloat lineSpacing = 0.0f; 127 | CGFloat interitemSpacing = 0.0f; 128 | 129 | if([self.delegate respondsToSelector:@selector(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:)]){ 130 | interitemSpacing = [self.delegate collectionView:cView layout:self minimumInteritemSpacingForSectionAtIndex:section]; 131 | } 132 | 133 | if([self.delegate respondsToSelector:@selector(collectionView:layout:minimumLineSpacingForSectionAtIndex:)]){ 134 | lineSpacing = [self.delegate collectionView:cView layout:self minimumLineSpacingForSectionAtIndex:section]; 135 | } 136 | 137 | itemsContentRect.origin.x = sectionInset.left; 138 | itemsContentRect.origin.y = headerHeight + sectionInset.top; 139 | 140 | NSUInteger numberOfColumns = [self.delegate collectionView:cView layout:self numberOfColumnsInSection:section]; 141 | itemsContentRect.size.width = CGRectGetWidth(cView.frame) - (sectionInset.left + sectionInset.right); 142 | 143 | CGFloat columnSpace = itemsContentRect.size.width - (interitemSpacing * (numberOfColumns-1)); 144 | CGFloat columnWidth = (columnSpace/numberOfColumns); 145 | 146 | // # store space for each column 147 | [columnRectsInSection addObject:[NSMutableArray arrayWithCapacity:numberOfColumns]]; 148 | for (NSUInteger colIdx = 0; colIdx < numberOfColumns; ++colIdx) 149 | [columnRectsInSection[section] addObject:[NSMutableArray array]]; 150 | 151 | // # Define the rect of the of each item 152 | for (NSInteger itemIdx = 0; itemIdx < numberOfItems; ++itemIdx) { 153 | NSIndexPath *itemPath = [NSIndexPath indexPathForItem:itemIdx inSection:section]; 154 | CGSize itemSize = [self.delegate collectionView:cView layout:self sizeForItemAtIndexPath:itemPath]; 155 | 156 | NSInteger destColumnIdx = [self preferredColumnIndexInSection:section]; 157 | NSInteger destRowInColumn = [self numberOfItemsInColumn:destColumnIdx ofSection:section]; 158 | CGFloat lastItemInColumnOffset = [self lastItemOffsetInColumn:destColumnIdx inSection:section]; 159 | 160 | if(destRowInColumn == 0){ 161 | lastItemInColumnOffset += sectionRect.origin.y; 162 | } 163 | 164 | CGRect itemRect; 165 | itemRect.origin.x = itemsContentRect.origin.x + destColumnIdx * (interitemSpacing + columnWidth); 166 | itemRect.origin.y = lastItemInColumnOffset + (destRowInColumn > 0 ? lineSpacing: sectionInset.top); 167 | itemRect.size.width = columnWidth; 168 | itemRect.size.height = itemSize.height; 169 | 170 | UICollectionViewLayoutAttributes *itemAttributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:itemPath]; 171 | itemAttributes.frame = itemRect; 172 | [layoutItemAttributes[section] addObject:itemAttributes]; 173 | [columnRectsInSection[section][destColumnIdx] addObject:[NSValue valueWithCGRect:itemRect]]; 174 | } 175 | 176 | itemsContentRect.size.height = [self heightOfItemsInSection:indexPath.section] + sectionInset.bottom; 177 | 178 | // # define the section footer 179 | CGFloat footerHeight = 0.0f; 180 | if([self.delegate respondsToSelector:@selector(collectionView:layout:referenceSizeForFooterInSection:)]){ 181 | CGRect footerFrame; 182 | footerFrame.origin.x = 0; 183 | footerFrame.origin.y = itemsContentRect.size.height; 184 | 185 | CGSize footerSize = [self.delegate collectionView:self.collectionView layout:self referenceSizeForFooterInSection:indexPath.section]; 186 | footerFrame.size.height = footerSize.height; 187 | footerFrame.size.width = footerSize.width; 188 | 189 | UICollectionViewLayoutAttributes *footerAttributes = [UICollectionViewLayoutAttributes 190 | layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionFooter 191 | withIndexPath:indexPath]; 192 | footerAttributes.frame = footerFrame; 193 | 194 | footerHeight = footerFrame.size.height; 195 | 196 | [headerFooterItemAttributes[UICollectionElementKindSectionFooter] addObject:footerAttributes]; 197 | } 198 | 199 | if(section > 0){ 200 | itemsContentRect.size.height -= sectionRect.origin.y; 201 | } 202 | 203 | sectionRect.size.height = itemsContentRect.size.height + footerHeight; 204 | 205 | [sectionRects addObject:[NSValue valueWithCGRect:sectionRect]]; 206 | } 207 | 208 | - (CGFloat)heightOfItemsInSection:(NSUInteger)sectionIdx { 209 | CGFloat maxHeightBetweenColumns = 0.0f; 210 | NSArray *columnsInSection = columnRectsInSection[sectionIdx]; 211 | for (NSUInteger columnIdx = 0; columnIdx < columnsInSection.count; ++columnIdx) { 212 | CGFloat heightOfColumn = [self lastItemOffsetInColumn:columnIdx inSection:sectionIdx]; 213 | maxHeightBetweenColumns = MAX(maxHeightBetweenColumns, heightOfColumn); 214 | } 215 | return maxHeightBetweenColumns; 216 | } 217 | 218 | - (NSInteger)numberOfItemsInColumn:(NSInteger)columnIdx ofSection:(NSInteger)sectionIdx { 219 | return [columnRectsInSection[sectionIdx][columnIdx] count]; 220 | } 221 | 222 | - (CGFloat)lastItemOffsetInColumn:(NSInteger)columnIdx inSection:(NSInteger)sectionIdx { 223 | NSArray *itemsInColumn = columnRectsInSection[sectionIdx][columnIdx]; 224 | if (itemsInColumn.count == 0) { 225 | if([headerFooterItemAttributes[UICollectionElementKindSectionHeader] count] > sectionIdx){ 226 | CGRect headerFrame = [headerFooterItemAttributes[UICollectionElementKindSectionHeader][sectionIdx] frame]; 227 | return headerFrame.size.height; 228 | } 229 | return 0.0f; 230 | } else { 231 | CGRect lastItemRect = [[itemsInColumn lastObject] CGRectValue]; 232 | return CGRectGetMaxY(lastItemRect); 233 | } 234 | } 235 | 236 | - (NSInteger)preferredColumnIndexInSection:(NSInteger)sectionIdx { 237 | NSUInteger shortestColumnIdx = 0; 238 | CGFloat heightOfShortestColumn = CGFLOAT_MAX; 239 | for (NSUInteger columnIdx = 0; columnIdx < [columnRectsInSection[sectionIdx] count]; ++columnIdx) { 240 | CGFloat columnHeight = [self lastItemOffsetInColumn:columnIdx inSection:sectionIdx]; 241 | if (columnHeight < heightOfShortestColumn) { 242 | shortestColumnIdx = columnIdx; 243 | heightOfShortestColumn = columnHeight; 244 | } 245 | } 246 | return shortestColumnIdx; 247 | } 248 | 249 | - (CGRect)rectForSectionAtIndex:(NSInteger)sectionIdx { 250 | if (sectionIdx < 0 || sectionIdx >= sectionRects.count) 251 | return CGRectZero; 252 | return [sectionRects[sectionIdx] CGRectValue]; 253 | } 254 | 255 | #pragma mark - Show Attributes Methods 256 | - (NSArray *)searchVisibleLayoutAttributesInRect:(CGRect)rect { 257 | NSMutableArray *itemAttrs = [[NSMutableArray alloc] init]; 258 | NSIndexSet *visibleSections = [self sectionIndexesInRect:rect]; 259 | [visibleSections enumerateIndexesUsingBlock:^(NSUInteger sectionIdx, BOOL *stop) { 260 | 261 | //# items 262 | for (UICollectionViewLayoutAttributes *itemAttr in layoutItemAttributes[sectionIdx]) { 263 | CGRect itemRect = itemAttr.frame; 264 | itemAttr.zIndex = 1; 265 | BOOL isVisible = CGRectIntersectsRect(rect, itemRect); 266 | if (isVisible) 267 | [itemAttrs addObject:itemAttr]; 268 | } 269 | 270 | //# footer 271 | if([headerFooterItemAttributes[UICollectionElementKindSectionFooter] count] > sectionIdx){ 272 | UICollectionViewLayoutAttributes *footerAttribute = headerFooterItemAttributes[UICollectionElementKindSectionFooter][sectionIdx]; 273 | BOOL isVisible = CGRectIntersectsRect(rect, footerAttribute.frame); 274 | if (isVisible && footerAttribute) 275 | [itemAttrs addObject:footerAttribute]; 276 | currentEdgeInsets = UIEdgeInsetsZero; 277 | }else{ 278 | currentEdgeInsets = [sectionInsetses[sectionIdx] UIEdgeInsetsValue]; 279 | } 280 | 281 | //# header 282 | if([headerFooterItemAttributes[UICollectionElementKindSectionHeader] count] > sectionIdx){ 283 | UICollectionViewLayoutAttributes *headerAttribute = headerFooterItemAttributes[UICollectionElementKindSectionHeader][sectionIdx]; 284 | 285 | if(!self.enableStickyHeaders){ 286 | BOOL isVisibleHeader = CGRectIntersectsRect(rect, headerAttribute.frame); 287 | 288 | if (isVisibleHeader && headerAttribute) 289 | [itemAttrs addObject:headerAttribute]; 290 | }else{ 291 | UICollectionViewLayoutAttributes *lastCell = [itemAttrs lastObject]; 292 | 293 | if(headerAttribute) 294 | [itemAttrs addObject:headerAttribute]; 295 | 296 | [self updateHeaderAttributes:headerAttribute lastCellAttributes:lastCell]; 297 | } 298 | } 299 | }]; 300 | return itemAttrs; 301 | } 302 | 303 | - (NSIndexSet *)sectionIndexesInRect:(CGRect)rect { 304 | CGRect theRect = rect; 305 | NSMutableIndexSet *visibleIndexes = [[NSMutableIndexSet alloc] init]; 306 | NSUInteger numberOfSections = self.collectionView.numberOfSections; 307 | for (NSUInteger sectionIdx = 0; sectionIdx < numberOfSections; ++sectionIdx) { 308 | CGRect sectionRect = [sectionRects[sectionIdx] CGRectValue]; 309 | BOOL isVisible = CGRectIntersectsRect(theRect, sectionRect); 310 | if (isVisible) 311 | [visibleIndexes addIndex:sectionIdx]; 312 | } 313 | return visibleIndexes; 314 | } 315 | 316 | #pragma mark - Sticky Header implementation methods 317 | 318 | - (void)updateHeaderAttributes:(UICollectionViewLayoutAttributes *)attributes 319 | lastCellAttributes:(UICollectionViewLayoutAttributes *)lastCellAttributes 320 | { 321 | CGRect currentBounds = self.collectionView.bounds; 322 | attributes.zIndex = 1024; 323 | attributes.hidden = NO; 324 | 325 | CGPoint origin = attributes.frame.origin; 326 | 327 | CGFloat sectionMaxY = CGRectGetMaxY(lastCellAttributes.frame) - attributes.frame.size.height + currentEdgeInsets.bottom; 328 | 329 | CGFloat y = CGRectGetMaxY(currentBounds) - currentBounds.size.height + self.collectionView.contentInset.top; 330 | 331 | //NSLog(@"%@",NSStringFromCGRect(currentBounds)); 332 | //NSLog(@"%@",NSStringFromCGPoint(origin)); 333 | 334 | CGFloat maxY = MIN(MAX(y, attributes.frame.origin.y), sectionMaxY); 335 | 336 | origin.y = maxY; 337 | 338 | attributes.frame = (CGRect){ 339 | origin, 340 | attributes.frame.size 341 | }; 342 | } 343 | 344 | @end 345 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Image/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Image/01.jpg -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Image/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Image/02.jpg -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Image/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Image/03.jpg -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Image/04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Image/04.jpg -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Image/05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/YXCollectionView/695a10d818d5b24a52a2b10b77412d2ed02333bc/YXCollectionView/YXCollectionView/Image/05.jpg -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/LeftPage/LeftViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LeftViewController.h 3 | // 侧滑菜单 4 | // 5 | // Created by yixiang on 15/7/13. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LeftViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/LeftPage/LeftViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LeftViewController.m 3 | // 侧滑菜单 4 | // 5 | // Created by yixiang on 15/7/13. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "LeftViewController.h" 10 | #import "SWRevealViewController.h" 11 | #import "Demo1ViewController.h" 12 | #import "Demo2ViewController.h" 13 | #import "Demo3ViewController.h" 14 | #import "Demo4ViewController.h" 15 | #import "Demo5ViewController.h" 16 | #import "Demo6ViewController.h" 17 | #import "Demo7ViewController.h" 18 | 19 | @interface LeftViewController() 20 | 21 | @property (nonatomic , strong) UITableView *tableView; 22 | 23 | @property (nonatomic , strong) NSArray *menuArray; 24 | 25 | @end 26 | 27 | @implementation LeftViewController 28 | 29 | -(void)viewDidLoad{ 30 | [super viewDidLoad]; 31 | [self initData]; 32 | [self initView]; 33 | } 34 | 35 | -(void)initData{ 36 | _menuArray = [NSArray arrayWithObjects:@"网格视图",@"无限轮播",@"照片墙",@"瀑布流",@"头部拉伸效果",@"倾斜的Cell",@"顶部cellheight逐步增大",nil]; 37 | } 38 | 39 | -(void)initView{ 40 | self.view.backgroundColor = [UIColor lightGrayColor]; 41 | 42 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT-20) style:UITableViewStyleGrouped]; 43 | _tableView.dataSource = self; 44 | _tableView.delegate = self; 45 | [self.view addSubview:_tableView]; 46 | } 47 | 48 | 49 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 50 | return _menuArray.count; 51 | } 52 | 53 | 54 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 55 | static NSString *TABLE_VIEW_ID = @"table_view_id"; 56 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TABLE_VIEW_ID]; 57 | if (!cell) { 58 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TABLE_VIEW_ID]; 59 | } 60 | cell.textLabel.text = [_menuArray objectAtIndex:indexPath.row]; 61 | 62 | return cell; 63 | } 64 | 65 | 66 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ 67 | return 0.01; 68 | } 69 | 70 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ 71 | return 0.01; 72 | } 73 | 74 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 75 | SWRevealViewController *revealViewController = self.revealViewController; 76 | UIViewController *viewController; 77 | 78 | switch (indexPath.row) { 79 | case 0: 80 | viewController = [[Demo1ViewController alloc] init]; 81 | break; 82 | case 1: 83 | viewController = [[Demo2ViewController alloc] init]; 84 | break; 85 | case 2: 86 | viewController = [[Demo3ViewController alloc] init]; 87 | break; 88 | case 3: 89 | viewController = [[Demo4ViewController alloc] init]; 90 | break; 91 | case 4: 92 | viewController = [[Demo5ViewController alloc] init]; 93 | break; 94 | case 5: 95 | viewController = [[Demo6ViewController alloc] init]; 96 | break; 97 | case 6: 98 | viewController = [[Demo7ViewController alloc] init]; 99 | break; 100 | default: 101 | break; 102 | } 103 | //调用pushFrontViewController进行页面切换 104 | [revealViewController pushFrontViewController:viewController animated:YES]; 105 | 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // 侧滑菜单 4 | // 5 | // Created by yixiang on 15/7/14. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #ifndef _____PrefixHeader_pch 10 | #define _____PrefixHeader_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | 15 | #define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width) 16 | #define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/RightPage/RightViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RightViewController.h 3 | // 侧滑菜单 4 | // 5 | // Created by yixiang on 15/7/13. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RightViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/RightPage/RightViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RightViewController.m 3 | // 侧滑菜单 4 | // 5 | // Created by yixiang on 15/7/13. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "RightViewController.h" 10 | 11 | @implementation RightViewController 12 | 13 | -(void)viewDidLoad{ 14 | [super viewDidLoad]; 15 | self.view.backgroundColor = [UIColor orangeColor]; 16 | 17 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2-100, 100, 200, 100)]; 18 | label.text = @"右边侧滑栏"; 19 | label.font = [UIFont systemFontOfSize:22]; 20 | label.textAlignment = NSTextAlignmentCenter; 21 | [self.view addSubview:label]; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/SWRevealViewController/SWRevealViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2013 Joan Lluch 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 furnished 10 | 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 21 | THE SOFTWARE. 22 | 23 | Early code inspired on a similar class by Philip Kluz (Philip.Kluz@zuui.org) 24 | 25 | */ 26 | 27 | /* 28 | 29 | RELEASE NOTES 30 | 31 | Version 2.4.0 (Current Version) 32 | 33 | - Updated behaviour of appearance method calls on child controllers 34 | - Removes Xcode 6.3.1 warnings 35 | 36 | Version 2.3.0 37 | 38 | - StoryBoard initializing bug fix 39 | - Minor Code refactoring 40 | 41 | Version 2.2.0 42 | 43 | - State Restoration support. 44 | - Reverted panGestureRecognizer implementation to before v2.1.0 (works better). 45 | - New properties 'toggleAnimationType', 'springDampingRatio'. Default reveal animation is 'Spring' 46 | - New property 'frontViewShadowColor' 47 | - New properties 'clipsViewsToBounds' and '_extendedPointInsideHit' 48 | - New delegate methods for finer control of front view location in the overdraw area, as long as deprecation note on former delegate methods 49 | - Other minor changes that should not affect current implementations 50 | 51 | Version 2.1.0 52 | 53 | - Removed SWDirectionPanGestureRecognizer. Horizontal panning is filtered on the shouldBegin delegate. This is cleaner, I hope it does not break previous funcionality 54 | - Took a cleaner approach to storyboard support. SWRevealViewControllerSegue is now deprecated and you should use SWRevealViewControllerSegueSetController and SWRevealViewControllerSeguePushController instead. 55 | - A minor change on the autoresizingMask of the internal views to fix a glitch on iOS8. This should not affect iOS7 56 | 57 | Version 2.0.2 58 | 59 | - Added new delegates for better control of gesture recognizers 60 | 61 | Version 2.0.1 62 | 63 | - Fix: draggableBorderWidth now correctly handles the cases where one of the rear controllers is not provided 64 | - Fix: the shadow related properties are now granted at any time after view load, not just after initialization. 65 | 66 | Version 2.0.0 67 | 68 | - Dropped support for iOS6 and earlier. This version will only work on iOS7 69 | 70 | - The method setFrontViewController:animated: does not longer perform a full reveal animation. Instead it just replaces the frontViewController in 71 | its current position. Use the new pushFrontViewController:animated: method to perform a replacement of the front controlles with reveal animation 72 | as in the previous version 73 | 74 | IMPORTANT: You must replace all calls to setFrontViewController:animated by calls to pushFrontViewController:animated to prevent breaking 75 | functionality on existing projects. 76 | 77 | - Added support for animated replacement of child controllers: setRearViewController, setFrontViewController, setRightViewController now have animated versions. 78 | 79 | - The new 'replaceViewAnimationDuration' property sets the default duration of child viewController replacement. 80 | 81 | - Added the following new delegate methods 82 | revealController:willAddViewController:forOperation:animated: 83 | revealController:didAddViewController:forOperation:animated: 84 | 85 | - The class also supports custom UIViewControllerAnimatedTransitioning related with the replacement of child viewControllers. 86 | You can implement the following new delegate method: revealController:animationControllerForOperation:fromViewController:toViewController: 87 | and provide an object conforming to UIViewControllerAnimatedTransitioning to implement custom animations. 88 | 89 | Version 1.1.3 90 | 91 | - Reverted the supportedInterfaceOrientations to the default behavior. This is consistent with Apple provided controllers 92 | 93 | - The presentFrontViewHierarchically now dynamically takes into account the smaller header height of bars on iPhone landscape orientation 94 | 95 | Version 1.1.2 96 | 97 | - The status bar style and appearance are now handled in sync with the class animations. 98 | You can implement the methods preferredStatusBarStyle and prefersStatusBarHidden on your child controllers to define the desired appearance 99 | 100 | - The loadView method now calls a method, loadStoryboardControllers, just for the purpose of loading child controllers from a storyboard. 101 | You can override this method and remove the @try @catch statements if you want the debugger not to stop at them in case you have set an exception breakpoint. 102 | 103 | Version 1.1.1 104 | 105 | - You can now get a tapGestureRecognizer from the class. See the tapGestureRecognizer method for more information. 106 | 107 | - Both the panGestureRecognizer and the tapGestureRecognizer are now attached to the revealViewController's front content view 108 | by default, so they will start working just by calling their access methods even if you do not attach them to any of your views. 109 | This enables you to dissable interactions on your views -for example based on position- without breaking normal gesture behavior. 110 | 111 | - Corrected a bug that caused a crash on iOS6 and earlier. 112 | 113 | Version 1.1.0 114 | 115 | - The method setFrontViewController:animated now performs the correct animations both for left and right controllers. 116 | 117 | - The class now automatically handles the status bar appearance depending on the currently shown child controller. 118 | 119 | Version 1.0.8 120 | 121 | - Support for constant width frontView by setting a negative value to reveal widths. See properties rearViewRevealWidth and rightViewRevealWidth 122 | 123 | - Support for draggableBorderWidth. See property of the same name. 124 | 125 | - The Pan gesture recongnizer can be disabled by implementing the following delegate method and returning NO 126 | revealControllerPanGestureShouldBegin: 127 | 128 | - Added the ability to track pan gesture reveal progress through the following new delegate methods 129 | revealController:panGestureBeganFromLocation:progress: 130 | revealController:panGestureMovedToLocation:progress: 131 | revealController:panGestureEndedToLocation:progress: 132 | 133 | Previous Versions 134 | 135 | - No release notes were updated for previous versions. 136 | 137 | */ 138 | 139 | 140 | #import 141 | 142 | @class SWRevealViewController; 143 | @protocol SWRevealViewControllerDelegate; 144 | 145 | #pragma mark - SWRevealViewController Class 146 | 147 | // Enum values for setFrontViewPosition:animated: 148 | typedef NS_ENUM( NSInteger, FrontViewPosition) 149 | { 150 | // Front controller is removed from view. Animated transitioning from this state will cause the same 151 | // effect than animating from FrontViewPositionLeftSideMost. Use this instead of FrontViewPositionLeftSideMost when 152 | // you want to remove the front view controller view from the view hierarchy. 153 | FrontViewPositionLeftSideMostRemoved, 154 | 155 | // Left most position, front view is presented left-offseted by rightViewRevealWidth+rigthViewRevealOverdraw 156 | FrontViewPositionLeftSideMost, 157 | 158 | // Left position, front view is presented left-offseted by rightViewRevealWidth 159 | FrontViewPositionLeftSide, 160 | 161 | // Center position, rear view is hidden behind front controller 162 | FrontViewPositionLeft, 163 | 164 | // Right possition, front view is presented right-offseted by rearViewRevealWidth 165 | FrontViewPositionRight, 166 | 167 | // Right most possition, front view is presented right-offseted by rearViewRevealWidth+rearViewRevealOverdraw 168 | FrontViewPositionRightMost, 169 | 170 | // Front controller is removed from view. Animated transitioning from this state will cause the same 171 | // effect than animating from FrontViewPositionRightMost. Use this instead of FrontViewPositionRightMost when 172 | // you intent to remove the front controller view from the view hierarchy. 173 | FrontViewPositionRightMostRemoved, 174 | 175 | }; 176 | 177 | // Enum values for toggleAnimationType 178 | typedef NS_ENUM(NSInteger, SWRevealToggleAnimationType) 179 | { 180 | SWRevealToggleAnimationTypeSpring, // <- produces a spring based animation 181 | SWRevealToggleAnimationTypeEaseOut, // <- produces an ease out curve animation 182 | }; 183 | 184 | 185 | @interface SWRevealViewController : UIViewController 186 | 187 | /* Basic API */ 188 | 189 | // Object instance init and rear view setting 190 | - (id)initWithRearViewController:(UIViewController *)rearViewController frontViewController:(UIViewController *)frontViewController; 191 | 192 | // Rear view controller, can be nil if not used 193 | @property (nonatomic) UIViewController *rearViewController; 194 | - (void)setRearViewController:(UIViewController *)rearViewController animated:(BOOL)animated; 195 | 196 | // Optional right view controller, can be nil if not used 197 | @property (nonatomic) UIViewController *rightViewController; 198 | - (void)setRightViewController:(UIViewController *)rightViewController animated:(BOOL)animated; 199 | 200 | // Front view controller, can be nil on initialization but must be supplied by the time the view is loaded 201 | @property (nonatomic) UIViewController *frontViewController; 202 | - (void)setFrontViewController:(UIViewController *)frontViewController animated:(BOOL)animated; 203 | 204 | // Sets the frontViewController using a default set of chained animations consisting on moving the 205 | // presented frontViewController to the right most possition, replacing it, and moving it back to the left position 206 | - (void)pushFrontViewController:(UIViewController *)frontViewController animated:(BOOL)animated; 207 | 208 | // Sets the frontViewController position. You can call the animated version several times with different 209 | // positions to obtain a set of animations that will be performed in order one after the other. 210 | @property (nonatomic) FrontViewPosition frontViewPosition; 211 | - (void)setFrontViewPosition:(FrontViewPosition)frontViewPosition animated:(BOOL)animated; 212 | 213 | // The following methods are meant to be directly connected to the action method of a button 214 | // to perform user triggered postion change of the controller views. This is ussually added to a 215 | // button on top left or right of the frontViewController 216 | - (IBAction)revealToggle:(id)sender; 217 | - (IBAction)rightRevealToggle:(id)sender; // <-- simetric implementation of the above for the rightViewController 218 | 219 | // Toogles the current state of the front controller between Left or Right and fully visible 220 | // Use setFrontViewPosition to set a particular position 221 | - (void)revealToggleAnimated:(BOOL)animated; 222 | - (void)rightRevealToggleAnimated:(BOOL)animated; // <-- simetric implementation of the above for the rightViewController 223 | 224 | // The following method will provide a panGestureRecognizer suitable to be added to any view 225 | // in order to perform usual drag and swipe gestures to reveal the rear views. This is usually added to the top bar 226 | // of a front controller, but it can be added to your frontViewController view or to the reveal controller view to provide full screen panning. 227 | // By default, the panGestureRecognizer is added to the view containing the front controller view. To keep this default behavior 228 | // you still need to call this method, just don't add it to any of your views. The default setup allows you to dissable 229 | // user interactions on your controller views without affecting the recognizer. 230 | - (UIPanGestureRecognizer*)panGestureRecognizer; 231 | 232 | // The following method will provide a tapGestureRecognizer suitable to be added to any view on the frontController 233 | // for concealing the rear views. By default no tap recognizer is created or added to any view, however if you call this method after 234 | // the controller's view has been loaded the recognizer is added to the reveal controller's front container view. 235 | // Thus, you can disable user interactions on your frontViewController view without affecting the tap recognizer. 236 | - (UITapGestureRecognizer*)tapGestureRecognizer; 237 | 238 | /* The following properties are provided for further customization, they are set to default values on initialization, 239 | you do not generally have to set them */ 240 | 241 | // Defines how much of the rear or right view is shown, default is 260. 242 | // Negative values indicate that the reveal width should be computed by substracting the full front view width, 243 | // so the revealed frontView width is kept constant when bounds change as opposed to the rear or right width. 244 | @property (nonatomic) CGFloat rearViewRevealWidth; 245 | @property (nonatomic) CGFloat rightViewRevealWidth; // <-- simetric implementation of the above for the rightViewController 246 | 247 | // Defines how much of an overdraw can occur when dragging further than 'rearViewRevealWidth', default is 60. 248 | @property (nonatomic) CGFloat rearViewRevealOverdraw; 249 | @property (nonatomic) CGFloat rightViewRevealOverdraw; // <-- simetric implementation of the above for the rightViewController 250 | 251 | // Defines how much displacement is applied to the rear view when animating or dragging the front view, default is 40. 252 | @property (nonatomic) CGFloat rearViewRevealDisplacement; 253 | @property (nonatomic) CGFloat rightViewRevealDisplacement; // <-- simetric implementation of the above for the rightViewController 254 | 255 | // Defines a width on the border of the view attached to the panGesturRecognizer where the gesture is allowed, 256 | // default is 0 which means no restriction. 257 | @property (nonatomic) CGFloat draggableBorderWidth; 258 | 259 | // If YES (the default) the controller will bounce to the Left position when dragging further than 'rearViewRevealWidth' 260 | @property (nonatomic) BOOL bounceBackOnOverdraw; 261 | @property (nonatomic) BOOL bounceBackOnLeftOverdraw; // <-- simetric implementation of the above for the rightViewController 262 | 263 | // If YES (default is NO) the controller will allow permanent dragging up to the rightMostPosition 264 | @property (nonatomic) BOOL stableDragOnOverdraw; 265 | @property (nonatomic) BOOL stableDragOnLeftOverdraw; // <-- simetric implementation of the above for the rightViewController 266 | 267 | // If YES (default is NO) the front view controller will be ofsseted vertically by the height of a navigation bar. 268 | // Use this on iOS7 when you add an instance of RevealViewController as a child of a UINavigationController (or another SWRevealViewController) 269 | // and you want the front view controller to be presented below the navigation bar of its UINavigationController grand parent. 270 | // The rearViewController will still appear full size and blurred behind the navigation bar of its UINavigationController grand parent 271 | @property (nonatomic) BOOL presentFrontViewHierarchically; 272 | 273 | // Velocity required for the controller to toggle its state based on a swipe movement, default is 250 274 | @property (nonatomic) CGFloat quickFlickVelocity; 275 | 276 | // Duration for the revealToggle animation, default is 0.25 277 | @property (nonatomic) NSTimeInterval toggleAnimationDuration; 278 | 279 | // Animation type, default is SWRevealToggleAnimationTypeSpring 280 | @property (nonatomic) SWRevealToggleAnimationType toggleAnimationType; 281 | 282 | // When animation type is SWRevealToggleAnimationTypeSpring determines the damping ratio, default is 1 283 | @property (nonatomic) CGFloat springDampingRatio; 284 | 285 | // Duration for animated replacement of view controllers 286 | @property (nonatomic) NSTimeInterval replaceViewAnimationDuration; 287 | 288 | // Defines the radius of the front view's shadow, default is 2.5f 289 | @property (nonatomic) CGFloat frontViewShadowRadius; 290 | 291 | // Defines the radius of the front view's shadow offset default is {0.0f,2.5f} 292 | @property (nonatomic) CGSize frontViewShadowOffset; 293 | 294 | // Defines the front view's shadow opacity, default is 1.0f 295 | @property (nonatomic) CGFloat frontViewShadowOpacity; 296 | 297 | // Defines the front view's shadow color, default is blackColor 298 | @property (nonatomic) UIColor *frontViewShadowColor; 299 | 300 | // Defines whether the controller should clip subviews to its view bounds. Default is NO. 301 | // Set this to YES when you are presenting this controller as a non full-screen child of a 302 | // custom container controller which does not explicitly clips its subviews. 303 | @property (nonatomic) BOOL clipsViewsToBounds; 304 | 305 | // Defines whether your views clicable area extends beyond the bounds of this controller. Default is NO. 306 | // Set this to YES if you are presenting this controller as a non full-screen child of a custom container and you are not 307 | // clipping your front view to this controller bounds. 308 | @property (nonatomic) BOOL extendsPointInsideHit; 309 | 310 | /* The class properly handles all the relevant calls to appearance methods on the contained controllers. 311 | Moreover you can assign a delegate to let the class inform you on positions and animation activity */ 312 | 313 | // Delegate 314 | @property (nonatomic,weak) id delegate; 315 | 316 | @end 317 | 318 | 319 | #pragma mark - SWRevealViewControllerDelegate Protocol 320 | 321 | typedef enum 322 | { 323 | SWRevealControllerOperationNone, 324 | SWRevealControllerOperationReplaceRearController, 325 | SWRevealControllerOperationReplaceFrontController, 326 | SWRevealControllerOperationReplaceRightController, 327 | 328 | } SWRevealControllerOperation; 329 | 330 | 331 | @protocol SWRevealViewControllerDelegate 332 | 333 | @optional 334 | 335 | // The following delegate methods will be called before and after the front view moves to a position 336 | - (void)revealController:(SWRevealViewController *)revealController willMoveToPosition:(FrontViewPosition)position; 337 | - (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position; 338 | 339 | // This will be called inside the reveal animation, thus you can use it to place your own code that will be animated in sync 340 | - (void)revealController:(SWRevealViewController *)revealController animateToPosition:(FrontViewPosition)position; 341 | 342 | // Implement this to return NO when you want the pan gesture recognizer to be ignored 343 | - (BOOL)revealControllerPanGestureShouldBegin:(SWRevealViewController *)revealController; 344 | 345 | // Implement this to return NO when you want the tap gesture recognizer to be ignored 346 | - (BOOL)revealControllerTapGestureShouldBegin:(SWRevealViewController *)revealController; 347 | 348 | // Implement this to return YES if you want other gesture recognizer to share touch events with the pan gesture 349 | - (BOOL)revealController:(SWRevealViewController *)revealController 350 | panGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; 351 | 352 | // Implement this to return YES if you want other gesture recognizer to share touch events with the tap gesture 353 | - (BOOL)revealController:(SWRevealViewController *)revealController 354 | tapGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; 355 | 356 | // Called when the gestureRecognizer began and ended 357 | - (void)revealControllerPanGestureBegan:(SWRevealViewController *)revealController; 358 | - (void)revealControllerPanGestureEnded:(SWRevealViewController *)revealController; 359 | 360 | // The following methods provide a means to track the evolution of the gesture recognizer. 361 | // The 'location' parameter is the X origin coordinate of the front view as the user drags it 362 | // The 'progress' parameter is a number ranging from 0 to 1 indicating the front view location relative to the 363 | // rearRevealWidth or rightRevealWidth. 1 is fully revealed, dragging ocurring in the overDraw region will result in values above 1. 364 | // The 'overProgress' parameter is a number ranging from 0 to 1 indicating the front view location relative to the 365 | // overdraw region. 0 is fully revealed, 1 is fully overdrawn. Negative values occur inside the normal reveal region 366 | - (void)revealController:(SWRevealViewController *)revealController panGestureBeganFromLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress; 367 | - (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress; 368 | - (void)revealController:(SWRevealViewController *)revealController panGestureEndedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress; 369 | 370 | // Notification of child controller replacement 371 | - (void)revealController:(SWRevealViewController *)revealController willAddViewController:(UIViewController *)viewController 372 | forOperation:(SWRevealControllerOperation)operation animated:(BOOL)animated; 373 | - (void)revealController:(SWRevealViewController *)revealController didAddViewController:(UIViewController *)viewController 374 | forOperation:(SWRevealControllerOperation)operation animated:(BOOL)animated; 375 | 376 | // Support for custom transition animations while replacing child controllers. If implemented, it will be fired in response 377 | // to calls to 'setXXViewController' methods 378 | - (id)revealController:(SWRevealViewController *)revealController 379 | animationControllerForOperation:(SWRevealControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC; 380 | 381 | // DEPRECATED - The following delegate methods will be removed some time in the future 382 | - (void)revealController:(SWRevealViewController *)revealController panGestureBeganFromLocation:(CGFloat)location progress:(CGFloat)progress; // (DEPRECATED) 383 | - (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress; // (DEPRECATED) 384 | - (void)revealController:(SWRevealViewController *)revealController panGestureEndedToLocation:(CGFloat)location progress:(CGFloat)progress; // (DEPRECATED) 385 | @end 386 | 387 | 388 | #pragma mark - UIViewController(SWRevealViewController) Category 389 | 390 | // A category of UIViewController to let childViewControllers easily access their parent SWRevealViewController 391 | @interface UIViewController(SWRevealViewController) 392 | 393 | - (SWRevealViewController*)revealViewController; 394 | 395 | @end 396 | 397 | 398 | #pragma mark - StoryBoard support Classes 399 | 400 | /* StoryBoard support */ 401 | 402 | // String identifiers to be applied to segues on a storyboard 403 | extern NSString* const SWSegueRearIdentifier; // this is @"sw_rear" 404 | extern NSString* const SWSegueFrontIdentifier; // this is @"sw_front" 405 | extern NSString* const SWSegueRightIdentifier; // this is @"sw_right" 406 | 407 | /* This will allow the class to be defined on a storyboard */ 408 | 409 | // Use this along with one of the above segue identifiers to segue to the initial state 410 | @interface SWRevealViewControllerSegueSetController : UIStoryboardSegue 411 | @end 412 | 413 | // Use this to push a view controller 414 | @interface SWRevealViewControllerSeguePushController : UIStoryboardSegue 415 | @end 416 | 417 | 418 | //#pragma mark - SWRevealViewControllerSegue (DEPRECATED) 419 | // 420 | //@interface SWRevealViewControllerSegue : UIStoryboardSegue // DEPRECATED: USE SWRevealViewControllerSegueSetController instead 421 | //@property (nonatomic, strong) void(^performBlock)( SWRevealViewControllerSegue* segue, UIViewController* svc, UIViewController* dvc ); 422 | //@end 423 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // YXCollectionView 4 | // 5 | // Created by yixiang on 15/10/10. 6 | // Copyright © 2015年 yixiang. 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 | -------------------------------------------------------------------------------- /YXCollectionView/YXCollectionView/resource.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | icon 7 | 01.jpg 8 | title 9 | 我是第一张图片 10 | 11 | 12 | icon 13 | 02.jpg 14 | title 15 | 我是第二张图片 16 | 17 | 18 | icon 19 | 03.jpg 20 | title 21 | 我是第三张图片 22 | 23 | 24 | icon 25 | 04.jpg 26 | title 27 | 我是第四张图片 28 | 29 | 30 | icon 31 | 05.jpg 32 | title 33 | 我是第五张图片 34 | 35 | 36 | 37 | --------------------------------------------------------------------------------