├── Gif
└── 1.gif
├── README.md
└── XLCycleCollectionViewDemo
├── XLCycleCollectionView
├── XLCycleCell.h
├── XLCycleCell.m
├── XLCycleCollectionView.h
└── XLCycleCollectionView.m
├── XLCycleCollectionViewDemo.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ │ └── MengXianLiang.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ └── MengXianLiang.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── XLCycleCollectionViewDemo.xcscheme
│ └── xcschememanagement.plist
└── XLCycleCollectionViewDemo
├── AppDelegate.h
├── AppDelegate.m
├── Assets.xcassets
└── AppIcon.appiconset
│ └── Contents.json
├── Base.lproj
├── LaunchScreen.storyboard
└── Main.storyboard
├── Info.plist
├── ViewController.h
├── ViewController.m
└── main.m
/Gif/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengxianliang/XLCycleCollectionView/73e14cf568fa4cd44bb65b328af283606bd93240/Gif/1.gif
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # XLCycleCollectionView
2 |
3 | 利用UICollectionView实现的无限循环的轮播图效果
4 |
5 | ### 显示效果:
6 |
7 |
8 |
9 | ### 使用方法:
10 |
11 | ```objc
12 | XLCycleCollectionView *cyleView = [[XLCycleCollectionView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, 200)];
13 | cyleView.data = @[@"Hello",@"world",@"!"];
14 | [self.view addSubview:cyleView];
15 | ```
16 |
17 | ### 实现原理请参考[我的博文](http://blog.csdn.net/u013282507/article/details/60583959)
18 |
19 | ### 个人开发过的UI工具集合 [XLUIKit](https://github.com/mengxianliang/XLUIKit)
20 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionView/XLCycleCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLCycleCell.h
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface XLCycleCell : UICollectionViewCell
12 |
13 | @property (nonatomic, copy) NSString *title;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionView/XLCycleCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLCycleCell.m
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. All rights reserved.
7 | //
8 |
9 | #import "XLCycleCell.h"
10 |
11 | @interface XLCycleCell ()
12 |
13 | @property (nonatomic, strong) UILabel *textLabel;
14 |
15 | @end
16 |
17 | @implementation XLCycleCell
18 |
19 | - (instancetype)initWithFrame:(CGRect)frame {
20 | if (self = [super initWithFrame:frame]) {
21 | [self buildUI];
22 | }
23 | return self;
24 | }
25 |
26 | - (void)buildUI {
27 | self.textLabel = [[UILabel alloc] initWithFrame:self.bounds];
28 | self.textLabel.textAlignment = NSTextAlignmentCenter;
29 | self.textLabel.font = [UIFont fontWithName:@"AmericanTypewriter" size:50];
30 | [self addSubview:self.textLabel];
31 | }
32 |
33 | - (void)setTitle:(NSString *)title {
34 | self.textLabel.text = title;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionView/XLCycleCollectionView.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLCycleCollectionView.h
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface XLCycleCollectionView : UIView
12 |
13 | @property (nonatomic, strong) NSArray *data;
14 |
15 | /**
16 | 自动翻页 默认 NO
17 | */
18 | @property (nonatomic, assign) BOOL autoPage;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionView/XLCycleCollectionView.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLCycleCollectionView.m
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. All rights reserved.
7 | //
8 |
9 | #import "XLCycleCollectionView.h"
10 | #import "XLCycleCell.h"
11 |
12 | //轮播间隔
13 | static CGFloat ScrollInterval = 3.0f;
14 |
15 | @interface XLCycleCollectionView ()
16 |
17 | @property (nonatomic, strong) UICollectionView *collectionView;
18 |
19 | @property (nonatomic, strong) UIPageControl *pageControl;
20 |
21 | @property (nonatomic, strong) NSTimer *timer;
22 |
23 | @property (nonatomic, strong) NSMutableArray *titles;
24 |
25 | @end
26 |
27 | @implementation XLCycleCollectionView
28 |
29 | - (instancetype)initWithFrame:(CGRect)frame {
30 | if (self = [super initWithFrame:frame]) {
31 | [self buildUI];
32 | }
33 | return self;
34 | }
35 |
36 | - (void)buildUI {
37 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
38 | layout.itemSize = CGSizeMake(self.bounds.size.width, self.bounds.size.height);
39 | layout.minimumLineSpacing = 0;
40 | layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
41 |
42 | self.collectionView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:layout];
43 | self.collectionView.delegate = self;
44 | self.collectionView.dataSource = self;
45 | self.collectionView.pagingEnabled = true;
46 | self.collectionView.backgroundColor = [UIColor clearColor];
47 | [self.collectionView registerClass:[XLCycleCell class] forCellWithReuseIdentifier:@"XLCycleCell"];
48 | self.collectionView.showsHorizontalScrollIndicator = false;
49 | [self addSubview:self.collectionView];
50 |
51 | CGFloat controlHeight = 35.0f;
52 | self.pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0, self.bounds.size.height - controlHeight, self.bounds.size.width, controlHeight)];
53 | self.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
54 | self.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
55 | [self addSubview:self.pageControl];
56 |
57 | self.timer = [NSTimer scheduledTimerWithTimeInterval:ScrollInterval target:self selector:@selector(showNext) userInfo:nil repeats:true];
58 | self.timer.fireDate = [NSDate distantFuture];
59 | _autoPage = NO;
60 | }
61 |
62 | #pragma mark -
63 | #pragma mark CollectionViewDelegate&DataSource
64 |
65 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
66 | return self.titles.count;
67 | }
68 |
69 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
70 | static NSString* cellId = @"XLCycleCell";
71 | XLCycleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
72 | cell.title = self.titles[indexPath.row];
73 | return cell;
74 | }
75 |
76 | //手动拖拽结束
77 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
78 | [self cycleScroll];
79 | //拖拽动作后间隔3s继续轮播
80 | if (_autoPage) {
81 | self.timer.fireDate = [NSDate dateWithTimeIntervalSinceNow:ScrollInterval];
82 | }
83 | }
84 |
85 | //自动轮播结束
86 | - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
87 | [self cycleScroll];
88 | }
89 |
90 | //循环显示
91 | - (void)cycleScroll {
92 | NSInteger page = self.collectionView.contentOffset.x/self.collectionView.bounds.size.width;
93 | if (page == 0) {//滚动到左边
94 | self.collectionView.contentOffset = CGPointMake(self.collectionView.bounds.size.width * (self.titles.count - 2), 0);
95 | self.pageControl.currentPage = self.titles.count - 2;
96 | }else if (page == self.titles.count - 1){//滚动到右边
97 | self.collectionView.contentOffset = CGPointMake(self.collectionView.bounds.size.width, 0);
98 | self.pageControl.currentPage = 0;
99 | }else{
100 | self.pageControl.currentPage = page - 1;
101 | }
102 | }
103 |
104 |
105 | #pragma mark -
106 | #pragma mark Setter
107 | //设置数据时在第一个之前和最后一个之后分别插入数据
108 | - (void)setData:(NSArray *)data {
109 | self.titles = [NSMutableArray arrayWithArray:data];
110 | [self.titles addObject:data.firstObject];
111 | [self.titles insertObject:data.lastObject atIndex:0];
112 | [self.collectionView setContentOffset:CGPointMake(self.collectionView.bounds.size.width, 0)];
113 | self.pageControl.numberOfPages = data.count;
114 | }
115 |
116 | - (void)setAutoPage:(BOOL)autoPage {
117 | _autoPage = autoPage;
118 | NSDate *fireDate = autoPage ? [NSDate dateWithTimeIntervalSinceNow:ScrollInterval] : [NSDate distantFuture];
119 | self.timer.fireDate = fireDate;
120 | }
121 |
122 | #pragma mark -
123 | #pragma mark 轮播方法
124 | //自动显示下一个
125 | - (void)showNext {
126 | //手指拖拽是禁止自动轮播
127 | if (self.collectionView.isDragging) {return;}
128 | CGFloat targetX = self.collectionView.contentOffset.x + self.collectionView.bounds.size.width;
129 | [self.collectionView setContentOffset:CGPointMake(targetX, 0) animated:true];
130 | }
131 |
132 |
133 | - (void)dealloc {
134 | [self.timer invalidate];
135 | }
136 |
137 | @end
138 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5E0C7D4B1E6D93A90050A6E0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0C7D4A1E6D93A90050A6E0 /* main.m */; };
11 | 5E0C7D4E1E6D93A90050A6E0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0C7D4D1E6D93A90050A6E0 /* AppDelegate.m */; };
12 | 5E0C7D511E6D93A90050A6E0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0C7D501E6D93A90050A6E0 /* ViewController.m */; };
13 | 5E0C7D541E6D93A90050A6E0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E0C7D521E6D93A90050A6E0 /* Main.storyboard */; };
14 | 5E0C7D561E6D93A90050A6E0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5E0C7D551E6D93A90050A6E0 /* Assets.xcassets */; };
15 | 5E0C7D591E6D93A90050A6E0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E0C7D571E6D93A90050A6E0 /* LaunchScreen.storyboard */; };
16 | 5E0C7D631E6D93D60050A6E0 /* XLCycleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0C7D621E6D93D60050A6E0 /* XLCycleCell.m */; };
17 | 5E0C7D661E6D93EC0050A6E0 /* XLCycleCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0C7D651E6D93EC0050A6E0 /* XLCycleCollectionView.m */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXFileReference section */
21 | 5E0C7D461E6D93A90050A6E0 /* XLCycleCollectionViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XLCycleCollectionViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
22 | 5E0C7D4A1E6D93A90050A6E0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
23 | 5E0C7D4C1E6D93A90050A6E0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
24 | 5E0C7D4D1E6D93A90050A6E0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
25 | 5E0C7D4F1E6D93A90050A6E0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
26 | 5E0C7D501E6D93A90050A6E0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
27 | 5E0C7D531E6D93A90050A6E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
28 | 5E0C7D551E6D93A90050A6E0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
29 | 5E0C7D581E6D93A90050A6E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
30 | 5E0C7D5A1E6D93A90050A6E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
31 | 5E0C7D611E6D93D60050A6E0 /* XLCycleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLCycleCell.h; sourceTree = ""; };
32 | 5E0C7D621E6D93D60050A6E0 /* XLCycleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLCycleCell.m; sourceTree = ""; };
33 | 5E0C7D641E6D93EC0050A6E0 /* XLCycleCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLCycleCollectionView.h; sourceTree = ""; };
34 | 5E0C7D651E6D93EC0050A6E0 /* XLCycleCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLCycleCollectionView.m; sourceTree = ""; };
35 | /* End PBXFileReference section */
36 |
37 | /* Begin PBXFrameworksBuildPhase section */
38 | 5E0C7D431E6D93A90050A6E0 /* Frameworks */ = {
39 | isa = PBXFrameworksBuildPhase;
40 | buildActionMask = 2147483647;
41 | files = (
42 | );
43 | runOnlyForDeploymentPostprocessing = 0;
44 | };
45 | /* End PBXFrameworksBuildPhase section */
46 |
47 | /* Begin PBXGroup section */
48 | 5E0C7D3D1E6D93A90050A6E0 = {
49 | isa = PBXGroup;
50 | children = (
51 | 5E0C7D601E6D93C30050A6E0 /* XLCycleCollectionView */,
52 | 5E0C7D481E6D93A90050A6E0 /* XLCycleCollectionViewDemo */,
53 | 5E0C7D471E6D93A90050A6E0 /* Products */,
54 | );
55 | sourceTree = "";
56 | };
57 | 5E0C7D471E6D93A90050A6E0 /* Products */ = {
58 | isa = PBXGroup;
59 | children = (
60 | 5E0C7D461E6D93A90050A6E0 /* XLCycleCollectionViewDemo.app */,
61 | );
62 | name = Products;
63 | sourceTree = "";
64 | };
65 | 5E0C7D481E6D93A90050A6E0 /* XLCycleCollectionViewDemo */ = {
66 | isa = PBXGroup;
67 | children = (
68 | 5E0C7D4C1E6D93A90050A6E0 /* AppDelegate.h */,
69 | 5E0C7D4D1E6D93A90050A6E0 /* AppDelegate.m */,
70 | 5E0C7D4F1E6D93A90050A6E0 /* ViewController.h */,
71 | 5E0C7D501E6D93A90050A6E0 /* ViewController.m */,
72 | 5E0C7D521E6D93A90050A6E0 /* Main.storyboard */,
73 | 5E0C7D551E6D93A90050A6E0 /* Assets.xcassets */,
74 | 5E0C7D571E6D93A90050A6E0 /* LaunchScreen.storyboard */,
75 | 5E0C7D5A1E6D93A90050A6E0 /* Info.plist */,
76 | 5E0C7D491E6D93A90050A6E0 /* Supporting Files */,
77 | );
78 | path = XLCycleCollectionViewDemo;
79 | sourceTree = "";
80 | };
81 | 5E0C7D491E6D93A90050A6E0 /* Supporting Files */ = {
82 | isa = PBXGroup;
83 | children = (
84 | 5E0C7D4A1E6D93A90050A6E0 /* main.m */,
85 | );
86 | name = "Supporting Files";
87 | sourceTree = "";
88 | };
89 | 5E0C7D601E6D93C30050A6E0 /* XLCycleCollectionView */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 5E0C7D641E6D93EC0050A6E0 /* XLCycleCollectionView.h */,
93 | 5E0C7D651E6D93EC0050A6E0 /* XLCycleCollectionView.m */,
94 | 5E0C7D611E6D93D60050A6E0 /* XLCycleCell.h */,
95 | 5E0C7D621E6D93D60050A6E0 /* XLCycleCell.m */,
96 | );
97 | path = XLCycleCollectionView;
98 | sourceTree = "";
99 | };
100 | /* End PBXGroup section */
101 |
102 | /* Begin PBXNativeTarget section */
103 | 5E0C7D451E6D93A90050A6E0 /* XLCycleCollectionViewDemo */ = {
104 | isa = PBXNativeTarget;
105 | buildConfigurationList = 5E0C7D5D1E6D93A90050A6E0 /* Build configuration list for PBXNativeTarget "XLCycleCollectionViewDemo" */;
106 | buildPhases = (
107 | 5E0C7D421E6D93A90050A6E0 /* Sources */,
108 | 5E0C7D431E6D93A90050A6E0 /* Frameworks */,
109 | 5E0C7D441E6D93A90050A6E0 /* Resources */,
110 | );
111 | buildRules = (
112 | );
113 | dependencies = (
114 | );
115 | name = XLCycleCollectionViewDemo;
116 | productName = XLCycleCollectionViewDemo;
117 | productReference = 5E0C7D461E6D93A90050A6E0 /* XLCycleCollectionViewDemo.app */;
118 | productType = "com.apple.product-type.application";
119 | };
120 | /* End PBXNativeTarget section */
121 |
122 | /* Begin PBXProject section */
123 | 5E0C7D3E1E6D93A90050A6E0 /* Project object */ = {
124 | isa = PBXProject;
125 | attributes = {
126 | LastUpgradeCheck = 0820;
127 | ORGANIZATIONNAME = MengXianLiang;
128 | TargetAttributes = {
129 | 5E0C7D451E6D93A90050A6E0 = {
130 | CreatedOnToolsVersion = 8.2.1;
131 | DevelopmentTeam = X496RVQDTB;
132 | ProvisioningStyle = Manual;
133 | };
134 | };
135 | };
136 | buildConfigurationList = 5E0C7D411E6D93A90050A6E0 /* Build configuration list for PBXProject "XLCycleCollectionViewDemo" */;
137 | compatibilityVersion = "Xcode 3.2";
138 | developmentRegion = English;
139 | hasScannedForEncodings = 0;
140 | knownRegions = (
141 | en,
142 | Base,
143 | );
144 | mainGroup = 5E0C7D3D1E6D93A90050A6E0;
145 | productRefGroup = 5E0C7D471E6D93A90050A6E0 /* Products */;
146 | projectDirPath = "";
147 | projectRoot = "";
148 | targets = (
149 | 5E0C7D451E6D93A90050A6E0 /* XLCycleCollectionViewDemo */,
150 | );
151 | };
152 | /* End PBXProject section */
153 |
154 | /* Begin PBXResourcesBuildPhase section */
155 | 5E0C7D441E6D93A90050A6E0 /* Resources */ = {
156 | isa = PBXResourcesBuildPhase;
157 | buildActionMask = 2147483647;
158 | files = (
159 | 5E0C7D591E6D93A90050A6E0 /* LaunchScreen.storyboard in Resources */,
160 | 5E0C7D561E6D93A90050A6E0 /* Assets.xcassets in Resources */,
161 | 5E0C7D541E6D93A90050A6E0 /* Main.storyboard in Resources */,
162 | );
163 | runOnlyForDeploymentPostprocessing = 0;
164 | };
165 | /* End PBXResourcesBuildPhase section */
166 |
167 | /* Begin PBXSourcesBuildPhase section */
168 | 5E0C7D421E6D93A90050A6E0 /* Sources */ = {
169 | isa = PBXSourcesBuildPhase;
170 | buildActionMask = 2147483647;
171 | files = (
172 | 5E0C7D631E6D93D60050A6E0 /* XLCycleCell.m in Sources */,
173 | 5E0C7D511E6D93A90050A6E0 /* ViewController.m in Sources */,
174 | 5E0C7D4E1E6D93A90050A6E0 /* AppDelegate.m in Sources */,
175 | 5E0C7D4B1E6D93A90050A6E0 /* main.m in Sources */,
176 | 5E0C7D661E6D93EC0050A6E0 /* XLCycleCollectionView.m in Sources */,
177 | );
178 | runOnlyForDeploymentPostprocessing = 0;
179 | };
180 | /* End PBXSourcesBuildPhase section */
181 |
182 | /* Begin PBXVariantGroup section */
183 | 5E0C7D521E6D93A90050A6E0 /* Main.storyboard */ = {
184 | isa = PBXVariantGroup;
185 | children = (
186 | 5E0C7D531E6D93A90050A6E0 /* Base */,
187 | );
188 | name = Main.storyboard;
189 | sourceTree = "";
190 | };
191 | 5E0C7D571E6D93A90050A6E0 /* LaunchScreen.storyboard */ = {
192 | isa = PBXVariantGroup;
193 | children = (
194 | 5E0C7D581E6D93A90050A6E0 /* Base */,
195 | );
196 | name = LaunchScreen.storyboard;
197 | sourceTree = "";
198 | };
199 | /* End PBXVariantGroup section */
200 |
201 | /* Begin XCBuildConfiguration section */
202 | 5E0C7D5B1E6D93A90050A6E0 /* Debug */ = {
203 | isa = XCBuildConfiguration;
204 | buildSettings = {
205 | ALWAYS_SEARCH_USER_PATHS = NO;
206 | CLANG_ANALYZER_NONNULL = YES;
207 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
208 | CLANG_CXX_LIBRARY = "libc++";
209 | CLANG_ENABLE_MODULES = YES;
210 | CLANG_ENABLE_OBJC_ARC = YES;
211 | CLANG_WARN_BOOL_CONVERSION = YES;
212 | CLANG_WARN_CONSTANT_CONVERSION = YES;
213 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
214 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
215 | CLANG_WARN_EMPTY_BODY = YES;
216 | CLANG_WARN_ENUM_CONVERSION = YES;
217 | CLANG_WARN_INFINITE_RECURSION = YES;
218 | CLANG_WARN_INT_CONVERSION = YES;
219 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
220 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
221 | CLANG_WARN_UNREACHABLE_CODE = YES;
222 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
223 | CODE_SIGN_IDENTITY = "iPhone Developer: xianliang meng (79SX5888C3)";
224 | CODE_SIGN_STYLE = Manual;
225 | COPY_PHASE_STRIP = NO;
226 | DEBUG_INFORMATION_FORMAT = dwarf;
227 | DEVELOPMENT_TEAM = X496RVQDTB;
228 | ENABLE_STRICT_OBJC_MSGSEND = YES;
229 | ENABLE_TESTABILITY = YES;
230 | GCC_C_LANGUAGE_STANDARD = gnu99;
231 | GCC_DYNAMIC_NO_PIC = NO;
232 | GCC_NO_COMMON_BLOCKS = YES;
233 | GCC_OPTIMIZATION_LEVEL = 0;
234 | GCC_PREPROCESSOR_DEFINITIONS = (
235 | "DEBUG=1",
236 | "$(inherited)",
237 | );
238 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
239 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
240 | GCC_WARN_UNDECLARED_SELECTOR = YES;
241 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
242 | GCC_WARN_UNUSED_FUNCTION = YES;
243 | GCC_WARN_UNUSED_VARIABLE = YES;
244 | IPHONEOS_DEPLOYMENT_TARGET = 10.2;
245 | MTL_ENABLE_DEBUG_INFO = YES;
246 | ONLY_ACTIVE_ARCH = YES;
247 | SDKROOT = iphoneos;
248 | };
249 | name = Debug;
250 | };
251 | 5E0C7D5C1E6D93A90050A6E0 /* Release */ = {
252 | isa = XCBuildConfiguration;
253 | buildSettings = {
254 | ALWAYS_SEARCH_USER_PATHS = NO;
255 | CLANG_ANALYZER_NONNULL = YES;
256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
257 | CLANG_CXX_LIBRARY = "libc++";
258 | CLANG_ENABLE_MODULES = YES;
259 | CLANG_ENABLE_OBJC_ARC = YES;
260 | CLANG_WARN_BOOL_CONVERSION = YES;
261 | CLANG_WARN_CONSTANT_CONVERSION = YES;
262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
263 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
264 | CLANG_WARN_EMPTY_BODY = YES;
265 | CLANG_WARN_ENUM_CONVERSION = YES;
266 | CLANG_WARN_INFINITE_RECURSION = YES;
267 | CLANG_WARN_INT_CONVERSION = YES;
268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
269 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
270 | CLANG_WARN_UNREACHABLE_CODE = YES;
271 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
272 | CODE_SIGN_IDENTITY = "iPhone Developer: xianliang meng (79SX5888C3)";
273 | CODE_SIGN_STYLE = Manual;
274 | COPY_PHASE_STRIP = NO;
275 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
276 | DEVELOPMENT_TEAM = X496RVQDTB;
277 | ENABLE_NS_ASSERTIONS = NO;
278 | ENABLE_STRICT_OBJC_MSGSEND = YES;
279 | GCC_C_LANGUAGE_STANDARD = gnu99;
280 | GCC_NO_COMMON_BLOCKS = YES;
281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
283 | GCC_WARN_UNDECLARED_SELECTOR = YES;
284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
285 | GCC_WARN_UNUSED_FUNCTION = YES;
286 | GCC_WARN_UNUSED_VARIABLE = YES;
287 | IPHONEOS_DEPLOYMENT_TARGET = 10.2;
288 | MTL_ENABLE_DEBUG_INFO = NO;
289 | SDKROOT = iphoneos;
290 | VALIDATE_PRODUCT = YES;
291 | };
292 | name = Release;
293 | };
294 | 5E0C7D5E1E6D93A90050A6E0 /* Debug */ = {
295 | isa = XCBuildConfiguration;
296 | buildSettings = {
297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
298 | CODE_SIGN_IDENTITY = "iPhone Developer: xianliang meng (79SX5888C3)";
299 | CODE_SIGN_STYLE = Manual;
300 | DEVELOPMENT_TEAM = X496RVQDTB;
301 | INFOPLIST_FILE = XLCycleCollectionViewDemo/Info.plist;
302 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
303 | PRODUCT_BUNDLE_IDENTIFIER = mxl.XLCycleCollectionViewDemo;
304 | PRODUCT_NAME = "$(TARGET_NAME)";
305 | PROVISIONING_PROFILE_SPECIFIER = mxlDev;
306 | };
307 | name = Debug;
308 | };
309 | 5E0C7D5F1E6D93A90050A6E0 /* Release */ = {
310 | isa = XCBuildConfiguration;
311 | buildSettings = {
312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
313 | CODE_SIGN_IDENTITY = "iPhone Developer: xianliang meng (79SX5888C3)";
314 | CODE_SIGN_STYLE = Manual;
315 | DEVELOPMENT_TEAM = X496RVQDTB;
316 | INFOPLIST_FILE = XLCycleCollectionViewDemo/Info.plist;
317 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
318 | PRODUCT_BUNDLE_IDENTIFIER = mxl.XLCycleCollectionViewDemo;
319 | PRODUCT_NAME = "$(TARGET_NAME)";
320 | PROVISIONING_PROFILE_SPECIFIER = mxlDev;
321 | };
322 | name = Release;
323 | };
324 | /* End XCBuildConfiguration section */
325 |
326 | /* Begin XCConfigurationList section */
327 | 5E0C7D411E6D93A90050A6E0 /* Build configuration list for PBXProject "XLCycleCollectionViewDemo" */ = {
328 | isa = XCConfigurationList;
329 | buildConfigurations = (
330 | 5E0C7D5B1E6D93A90050A6E0 /* Debug */,
331 | 5E0C7D5C1E6D93A90050A6E0 /* Release */,
332 | );
333 | defaultConfigurationIsVisible = 0;
334 | defaultConfigurationName = Release;
335 | };
336 | 5E0C7D5D1E6D93A90050A6E0 /* Build configuration list for PBXNativeTarget "XLCycleCollectionViewDemo" */ = {
337 | isa = XCConfigurationList;
338 | buildConfigurations = (
339 | 5E0C7D5E1E6D93A90050A6E0 /* Debug */,
340 | 5E0C7D5F1E6D93A90050A6E0 /* Release */,
341 | );
342 | defaultConfigurationIsVisible = 0;
343 | defaultConfigurationName = Release;
344 | };
345 | /* End XCConfigurationList section */
346 | };
347 | rootObject = 5E0C7D3E1E6D93A90050A6E0 /* Project object */;
348 | }
349 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/project.xcworkspace/xcuserdata/MengXianLiang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengxianliang/XLCycleCollectionView/73e14cf568fa4cd44bb65b328af283606bd93240/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/project.xcworkspace/xcuserdata/MengXianLiang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/xcuserdata/MengXianLiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/xcuserdata/MengXianLiang.xcuserdatad/xcschemes/XLCycleCollectionViewDemo.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 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo.xcodeproj/xcuserdata/MengXianLiang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | XLCycleCollectionViewDemo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 5E0C7D451E6D93A90050A6E0
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. 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 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/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 | }
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/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 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "XLCycleCollectionView.h"
11 |
12 | @interface ViewController ()
13 |
14 | @end
15 |
16 | @implementation ViewController
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | XLCycleCollectionView *cyleView = [[XLCycleCollectionView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, 200)];
22 | cyleView.data = @[@"Hello",@"world",@"!"];
23 | cyleView.autoPage = YES;
24 | [self.view addSubview:cyleView];
25 | }
26 |
27 | - (void)didReceiveMemoryWarning {
28 | [super didReceiveMemoryWarning];
29 | // Dispose of any resources that can be recreated.
30 | }
31 |
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/XLCycleCollectionViewDemo/XLCycleCollectionViewDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // XLCycleCollectionViewDemo
4 | //
5 | // Created by MengXianLiang on 2017/3/6.
6 | // Copyright © 2017年 MengXianLiang. 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 |
--------------------------------------------------------------------------------