├── README.md ├── YYInfiniteScrollView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── various.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── various.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── YYInfiniteScrollView.xcscheme │ └── xcschememanagement.plist ├── YYInfiniteScrollView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── Reveal.framework │ ├── Headers │ ├── Reveal │ └── Versions │ │ ├── A │ │ ├── Headers │ │ │ ├── IBANetServiceTypes.h │ │ │ ├── IBARevealLoader.h │ │ │ ├── IBARevealLogger.h │ │ │ └── Reveal.h │ │ └── Reveal │ │ └── Current ├── ViewController.h ├── ViewController.m ├── YYInfiniteScrollView.h ├── YYInfiniteScrollView.m ├── class │ ├── DetailViewController.h │ ├── DetailViewController.m │ ├── DetailViewController.xib │ └── Resources │ │ ├── page1.jpg │ │ ├── page2.jpg │ │ ├── page3.jpg │ │ ├── page4.jpg │ │ ├── page5.jpg │ │ └── page6.jpg └── main.m ├── sample1.png └── sample2.png /README.md: -------------------------------------------------------------------------------- 1 | YYInfiniteScrollView 2 | ===================== 3 | 4 | Overview 5 | -------- 6 | YYInfiniteScrollView is a subclass of UIView. It contains an endlessly scrollable UIScrollView, and you can click the subview on the scrollview. Some of the function get inspiration from https://github.com/caesarcat/InfinitePagingView. 7 | 8 | 9 | Features 10 | -------- 11 | - Endlessly scrollable to horizontal direction and show the previous and next subview. 12 | - Each page view contents are available to a UIView based custom view. 13 | - Implements paging scroll and click delegate protocol. 14 | - Page scroll action methods. 15 | - Page click action methods. 16 | 17 | 18 | Requirements 19 | ------------ 20 | - iOS 7.0+ 21 | - Xcode 5 (Use ARC) 22 | 23 | Screenshots 24 | ----------- 25 | ![Screenshot0](https://github.com/various/YYInfiniteScrollView/blob/master/sample1.png) 26 | ![Screenshot0](https://github.com/various/YYInfiniteScrollView/blob/master/sample2.png) 27 | 28 | 29 | How to use 30 | ---------- 31 | 32 | ```Objective-C 33 | #import "YYInfiniteScrollView.h" 34 | ... 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | self.title = @"YYInfiniteScrollView"; 38 | self.infiniteScrollView = [[YYInfiniteScrollView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 260) contentSpacing:10]; 39 | self.infiniteScrollView.delegate = self; 40 | self.infiniteScrollView.pageSize = CGSizeMake(535, 260); 41 | NSMutableArray *imageViews = [[NSMutableArray alloc] init]; 42 | for (int i = 1; i <= 6; ++i) { 43 | UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"page%d.jpg", i]]; 44 | UIImageView *page = [[UIImageView alloc] initWithImage:image]; 45 | page.frame = CGRectMake(0.f, 0.f, 535, 260); 46 | page.contentMode = UIViewContentModeScaleAspectFill; 47 | UILabel *label = [[UILabel alloc] init]; 48 | label.text = [NSString stringWithFormat:@"%d",i]; 49 | label.frame = CGRectMake(0, 0, 100, 100); 50 | label.font = [UIFont fontWithName:@"Helvetica" size:100]; 51 | label.textAlignment = NSTextAlignmentCenter; 52 | [label setTextColor:[UIColor whiteColor]]; 53 | label.center = page.center; 54 | [page addSubview:label]; 55 | [imageViews addObject:page]; 56 | } 57 | [self.infiniteScrollView addPageViews:imageViews]; 58 | [self.view addSubview:self.infiniteScrollView]; 59 | } 60 | ``` 61 | 62 | Build and run the project files. Enjoy more examples! 63 | 64 | Public methods 65 | -------- 66 | 67 | ```Objective-C 68 | - (void)addPageViews:(NSArray *)pageView; 69 | ``` 70 | Adds views to the inner scrollview's subviews. 71 | 72 | - 73 | 74 | ```Objective-C 75 | - (void)scrollToPreviousPage; 76 | ``` 77 | Scroll to the previous page. 78 | 79 | - 80 | 81 | ```Objective-C 82 | - (void)scrollToNextPage; 83 | ``` 84 | Scroll to the next page. 85 | 86 | 87 | 88 | YYInfiniteScrollViewDelegate Protocols 89 | - 90 | 91 | ```Objective-C 92 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didClickIndex:(int)index; 93 | ``` 94 | Tells the delegate when the paging view is cilcked. 95 | 96 | - 97 | 98 | ```Objective-C 99 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView willBeginDragging:(UIScrollView *)scrollView; 100 | ``` 101 | Tells the delegate when the paging view is about to start scrolling the content. 102 | 103 | - 104 | 105 | ```Objective-C 106 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didScroll:(UIScrollView *)scrollView; 107 | ``` 108 | Tells the delegate when the user scrolls the content view within the receiver. 109 | 110 | - 111 | 112 | ```Objective-C 113 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didEndDragging:(UIScrollView *)scrollView; 114 | ``` 115 | Tells the delegate when dragging ended in the paging view. 116 | 117 | 118 | - 119 | 120 | ```Objective-C 121 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView willBeginDecelerating:(UIScrollView *)scrollView; 122 | ``` 123 | 124 | Tells the delegate that the paging view is starting to decelerate the scrolling movement. 125 | 126 | - 127 | 128 | ```Objective-C 129 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didEndDecelerating:(UIScrollView *)scrollView ; 130 | ``` 131 | Tells the delegate that the scroll view has ended decelerating the scrolling movement. 132 | 133 | 134 | 135 | License 136 | ------- 137 | This software is released under the MIT License, see LICENSE.txt. 138 | 139 | -------------------------------------------------------------------------------- /YYInfiniteScrollView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 193D900C1C1E908C00E70C07 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 193D900B1C1E908C00E70C07 /* main.m */; }; 11 | 193D900F1C1E908C00E70C07 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 193D900E1C1E908C00E70C07 /* AppDelegate.m */; }; 12 | 193D90121C1E908C00E70C07 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 193D90111C1E908C00E70C07 /* ViewController.m */; }; 13 | 193D90151C1E908C00E70C07 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 193D90131C1E908C00E70C07 /* Main.storyboard */; }; 14 | 193D90171C1E908C00E70C07 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 193D90161C1E908C00E70C07 /* Assets.xcassets */; }; 15 | 193D901A1C1E908C00E70C07 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 193D90181C1E908C00E70C07 /* LaunchScreen.storyboard */; }; 16 | 193D90241C1E912D00E70C07 /* YYInfiniteScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 193D90231C1E912D00E70C07 /* YYInfiniteScrollView.m */; }; 17 | 193D902C1C1EAFE400E70C07 /* page6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 193D90261C1EAFE400E70C07 /* page6.jpg */; }; 18 | 193D902D1C1EAFE400E70C07 /* page5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 193D90271C1EAFE400E70C07 /* page5.jpg */; }; 19 | 193D902E1C1EAFE400E70C07 /* page4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 193D90281C1EAFE400E70C07 /* page4.jpg */; }; 20 | 193D902F1C1EAFE400E70C07 /* page3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 193D90291C1EAFE400E70C07 /* page3.jpg */; }; 21 | 193D90301C1EAFE400E70C07 /* page2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 193D902A1C1EAFE400E70C07 /* page2.jpg */; }; 22 | 193D90311C1EAFE400E70C07 /* page1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 193D902B1C1EAFE400E70C07 /* page1.jpg */; }; 23 | 193D90351C1EB19A00E70C07 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 193D90331C1EB19A00E70C07 /* DetailViewController.m */; }; 24 | 193D90361C1EB19A00E70C07 /* DetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 193D90341C1EB19A00E70C07 /* DetailViewController.xib */; }; 25 | 193D90381C1ED01200E70C07 /* Reveal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 193D90371C1ED01200E70C07 /* Reveal.framework */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 193D90071C1E908C00E70C07 /* YYInfiniteScrollView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YYInfiniteScrollView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 193D900B1C1E908C00E70C07 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ../main.m; sourceTree = ""; }; 31 | 193D900D1C1E908C00E70C07 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../AppDelegate.h; sourceTree = ""; }; 32 | 193D900E1C1E908C00E70C07 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ../AppDelegate.m; sourceTree = ""; }; 33 | 193D90101C1E908C00E70C07 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = ../ViewController.h; sourceTree = ""; }; 34 | 193D90111C1E908C00E70C07 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = ../ViewController.m; sourceTree = ""; }; 35 | 193D90141C1E908C00E70C07 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 36 | 193D90161C1E908C00E70C07 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../Assets.xcassets; sourceTree = ""; }; 37 | 193D90191C1E908C00E70C07 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 38 | 193D901B1C1E908C00E70C07 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; 39 | 193D90221C1E912D00E70C07 /* YYInfiniteScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YYInfiniteScrollView.h; sourceTree = ""; }; 40 | 193D90231C1E912D00E70C07 /* YYInfiniteScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YYInfiniteScrollView.m; sourceTree = ""; }; 41 | 193D90261C1EAFE400E70C07 /* page6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = page6.jpg; sourceTree = ""; }; 42 | 193D90271C1EAFE400E70C07 /* page5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = page5.jpg; sourceTree = ""; }; 43 | 193D90281C1EAFE400E70C07 /* page4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = page4.jpg; sourceTree = ""; }; 44 | 193D90291C1EAFE400E70C07 /* page3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = page3.jpg; sourceTree = ""; }; 45 | 193D902A1C1EAFE400E70C07 /* page2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = page2.jpg; sourceTree = ""; }; 46 | 193D902B1C1EAFE400E70C07 /* page1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = page1.jpg; sourceTree = ""; }; 47 | 193D90321C1EB19A00E70C07 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; 48 | 193D90331C1EB19A00E70C07 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; 49 | 193D90341C1EB19A00E70C07 /* DetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DetailViewController.xib; sourceTree = ""; }; 50 | 193D90371C1ED01200E70C07 /* Reveal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Reveal.framework; path = YYInfiniteScrollView/Reveal.framework; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 193D90041C1E908C00E70C07 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | 193D90381C1ED01200E70C07 /* Reveal.framework in Frameworks */, 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 193D8FFE1C1E908C00E70C07 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 193D90371C1ED01200E70C07 /* Reveal.framework */, 69 | 193D90091C1E908C00E70C07 /* YYInfiniteScrollView */, 70 | 193D90211C1E90F500E70C07 /* Classes */, 71 | 193D90081C1E908C00E70C07 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | 193D90081C1E908C00E70C07 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 193D90071C1E908C00E70C07 /* YYInfiniteScrollView.app */, 79 | ); 80 | name = Products; 81 | sourceTree = ""; 82 | }; 83 | 193D90091C1E908C00E70C07 /* YYInfiniteScrollView */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 193D90221C1E912D00E70C07 /* YYInfiniteScrollView.h */, 87 | 193D90231C1E912D00E70C07 /* YYInfiniteScrollView.m */, 88 | ); 89 | path = YYInfiniteScrollView; 90 | sourceTree = ""; 91 | }; 92 | 193D900A1C1E908C00E70C07 /* Supporting Files */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | ); 96 | name = "Supporting Files"; 97 | path = ..; 98 | sourceTree = ""; 99 | }; 100 | 193D90211C1E90F500E70C07 /* Classes */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 193D90251C1EAFB500E70C07 /* Resources */, 104 | 193D900D1C1E908C00E70C07 /* AppDelegate.h */, 105 | 193D900E1C1E908C00E70C07 /* AppDelegate.m */, 106 | 193D90101C1E908C00E70C07 /* ViewController.h */, 107 | 193D90111C1E908C00E70C07 /* ViewController.m */, 108 | 193D90321C1EB19A00E70C07 /* DetailViewController.h */, 109 | 193D90331C1EB19A00E70C07 /* DetailViewController.m */, 110 | 193D90341C1EB19A00E70C07 /* DetailViewController.xib */, 111 | 193D90131C1E908C00E70C07 /* Main.storyboard */, 112 | 193D90161C1E908C00E70C07 /* Assets.xcassets */, 113 | 193D90181C1E908C00E70C07 /* LaunchScreen.storyboard */, 114 | 193D901B1C1E908C00E70C07 /* Info.plist */, 115 | 193D900A1C1E908C00E70C07 /* Supporting Files */, 116 | 193D900B1C1E908C00E70C07 /* main.m */, 117 | ); 118 | name = Classes; 119 | path = YYInfiniteScrollView/class; 120 | sourceTree = ""; 121 | }; 122 | 193D90251C1EAFB500E70C07 /* Resources */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 193D90261C1EAFE400E70C07 /* page6.jpg */, 126 | 193D90271C1EAFE400E70C07 /* page5.jpg */, 127 | 193D90281C1EAFE400E70C07 /* page4.jpg */, 128 | 193D90291C1EAFE400E70C07 /* page3.jpg */, 129 | 193D902A1C1EAFE400E70C07 /* page2.jpg */, 130 | 193D902B1C1EAFE400E70C07 /* page1.jpg */, 131 | ); 132 | path = Resources; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXNativeTarget section */ 138 | 193D90061C1E908C00E70C07 /* YYInfiniteScrollView */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 193D901E1C1E908C00E70C07 /* Build configuration list for PBXNativeTarget "YYInfiniteScrollView" */; 141 | buildPhases = ( 142 | 193D90031C1E908C00E70C07 /* Sources */, 143 | 193D90041C1E908C00E70C07 /* Frameworks */, 144 | 193D90051C1E908C00E70C07 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = YYInfiniteScrollView; 151 | productName = YYInfiniteScrollView; 152 | productReference = 193D90071C1E908C00E70C07 /* YYInfiniteScrollView.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | /* End PBXNativeTarget section */ 156 | 157 | /* Begin PBXProject section */ 158 | 193D8FFF1C1E908C00E70C07 /* Project object */ = { 159 | isa = PBXProject; 160 | attributes = { 161 | LastUpgradeCheck = 0710; 162 | ORGANIZATIONNAME = Baozou; 163 | TargetAttributes = { 164 | 193D90061C1E908C00E70C07 = { 165 | CreatedOnToolsVersion = 7.1.1; 166 | DevelopmentTeam = GD2NSEEHN2; 167 | }; 168 | }; 169 | }; 170 | buildConfigurationList = 193D90021C1E908C00E70C07 /* Build configuration list for PBXProject "YYInfiniteScrollView" */; 171 | compatibilityVersion = "Xcode 3.2"; 172 | developmentRegion = English; 173 | hasScannedForEncodings = 0; 174 | knownRegions = ( 175 | en, 176 | Base, 177 | ); 178 | mainGroup = 193D8FFE1C1E908C00E70C07; 179 | productRefGroup = 193D90081C1E908C00E70C07 /* Products */; 180 | projectDirPath = ""; 181 | projectRoot = ""; 182 | targets = ( 183 | 193D90061C1E908C00E70C07 /* YYInfiniteScrollView */, 184 | ); 185 | }; 186 | /* End PBXProject section */ 187 | 188 | /* Begin PBXResourcesBuildPhase section */ 189 | 193D90051C1E908C00E70C07 /* Resources */ = { 190 | isa = PBXResourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | 193D901A1C1E908C00E70C07 /* LaunchScreen.storyboard in Resources */, 194 | 193D90171C1E908C00E70C07 /* Assets.xcassets in Resources */, 195 | 193D90151C1E908C00E70C07 /* Main.storyboard in Resources */, 196 | 193D902D1C1EAFE400E70C07 /* page5.jpg in Resources */, 197 | 193D902C1C1EAFE400E70C07 /* page6.jpg in Resources */, 198 | 193D90311C1EAFE400E70C07 /* page1.jpg in Resources */, 199 | 193D902E1C1EAFE400E70C07 /* page4.jpg in Resources */, 200 | 193D90361C1EB19A00E70C07 /* DetailViewController.xib in Resources */, 201 | 193D902F1C1EAFE400E70C07 /* page3.jpg in Resources */, 202 | 193D90301C1EAFE400E70C07 /* page2.jpg in Resources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXResourcesBuildPhase section */ 207 | 208 | /* Begin PBXSourcesBuildPhase section */ 209 | 193D90031C1E908C00E70C07 /* Sources */ = { 210 | isa = PBXSourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | 193D90351C1EB19A00E70C07 /* DetailViewController.m in Sources */, 214 | 193D90121C1E908C00E70C07 /* ViewController.m in Sources */, 215 | 193D900F1C1E908C00E70C07 /* AppDelegate.m in Sources */, 216 | 193D90241C1E912D00E70C07 /* YYInfiniteScrollView.m in Sources */, 217 | 193D900C1C1E908C00E70C07 /* main.m in Sources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | /* End PBXSourcesBuildPhase section */ 222 | 223 | /* Begin PBXVariantGroup section */ 224 | 193D90131C1E908C00E70C07 /* Main.storyboard */ = { 225 | isa = PBXVariantGroup; 226 | children = ( 227 | 193D90141C1E908C00E70C07 /* Base */, 228 | ); 229 | name = Main.storyboard; 230 | path = ..; 231 | sourceTree = ""; 232 | }; 233 | 193D90181C1E908C00E70C07 /* LaunchScreen.storyboard */ = { 234 | isa = PBXVariantGroup; 235 | children = ( 236 | 193D90191C1E908C00E70C07 /* Base */, 237 | ); 238 | name = LaunchScreen.storyboard; 239 | path = ..; 240 | sourceTree = ""; 241 | }; 242 | /* End PBXVariantGroup section */ 243 | 244 | /* Begin XCBuildConfiguration section */ 245 | 193D901C1C1E908C00E70C07 /* Debug */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 250 | CLANG_CXX_LIBRARY = "libc++"; 251 | CLANG_ENABLE_MODULES = YES; 252 | CLANG_ENABLE_OBJC_ARC = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 256 | CLANG_WARN_EMPTY_BODY = YES; 257 | CLANG_WARN_ENUM_CONVERSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = dwarf; 265 | ENABLE_STRICT_OBJC_MSGSEND = YES; 266 | ENABLE_TESTABILITY = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_DYNAMIC_NO_PIC = NO; 269 | GCC_NO_COMMON_BLOCKS = YES; 270 | GCC_OPTIMIZATION_LEVEL = 0; 271 | GCC_PREPROCESSOR_DEFINITIONS = ( 272 | "DEBUG=1", 273 | "$(inherited)", 274 | ); 275 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 276 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 277 | GCC_WARN_UNDECLARED_SELECTOR = YES; 278 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 279 | GCC_WARN_UNUSED_FUNCTION = YES; 280 | GCC_WARN_UNUSED_VARIABLE = YES; 281 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 282 | MTL_ENABLE_DEBUG_INFO = YES; 283 | ONLY_ACTIVE_ARCH = YES; 284 | SDKROOT = iphoneos; 285 | TARGETED_DEVICE_FAMILY = 2; 286 | }; 287 | name = Debug; 288 | }; 289 | 193D901D1C1E908C00E70C07 /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ALWAYS_SEARCH_USER_PATHS = NO; 293 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 294 | CLANG_CXX_LIBRARY = "libc++"; 295 | CLANG_ENABLE_MODULES = YES; 296 | CLANG_ENABLE_OBJC_ARC = YES; 297 | CLANG_WARN_BOOL_CONVERSION = YES; 298 | CLANG_WARN_CONSTANT_CONVERSION = YES; 299 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 300 | CLANG_WARN_EMPTY_BODY = YES; 301 | CLANG_WARN_ENUM_CONVERSION = YES; 302 | CLANG_WARN_INT_CONVERSION = YES; 303 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 304 | CLANG_WARN_UNREACHABLE_CODE = YES; 305 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 306 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 307 | COPY_PHASE_STRIP = NO; 308 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 309 | ENABLE_NS_ASSERTIONS = NO; 310 | ENABLE_STRICT_OBJC_MSGSEND = YES; 311 | GCC_C_LANGUAGE_STANDARD = gnu99; 312 | GCC_NO_COMMON_BLOCKS = YES; 313 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 314 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 315 | GCC_WARN_UNDECLARED_SELECTOR = YES; 316 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 317 | GCC_WARN_UNUSED_FUNCTION = YES; 318 | GCC_WARN_UNUSED_VARIABLE = YES; 319 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 320 | MTL_ENABLE_DEBUG_INFO = NO; 321 | SDKROOT = iphoneos; 322 | TARGETED_DEVICE_FAMILY = 2; 323 | VALIDATE_PRODUCT = YES; 324 | }; 325 | name = Release; 326 | }; 327 | 193D901F1C1E908C00E70C07 /* Debug */ = { 328 | isa = XCBuildConfiguration; 329 | buildSettings = { 330 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 331 | CODE_SIGN_IDENTITY = "iPhone Developer: jian ren (BR4JFVUR2Z)"; 332 | ENABLE_BITCODE = NO; 333 | FRAMEWORK_SEARCH_PATHS = ( 334 | "$(inherited)", 335 | "$(PROJECT_DIR)/YYInfiniteScrollView", 336 | ); 337 | INFOPLIST_FILE = YYInfiniteScrollView/Info.plist; 338 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 340 | OTHER_LDFLAGS = ( 341 | "-ObjC", 342 | "-lz", 343 | "-framework", 344 | Reveal, 345 | ); 346 | PRODUCT_BUNDLE_IDENTIFIER = com.baozou.BaoZouTVHD; 347 | PRODUCT_NAME = "$(TARGET_NAME)"; 348 | PROVISIONING_PROFILE = ""; 349 | }; 350 | name = Debug; 351 | }; 352 | 193D90201C1E908C00E70C07 /* Release */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 356 | CODE_SIGN_IDENTITY = "iPhone Developer"; 357 | ENABLE_BITCODE = NO; 358 | FRAMEWORK_SEARCH_PATHS = ( 359 | "$(inherited)", 360 | "$(PROJECT_DIR)/YYInfiniteScrollView", 361 | ); 362 | INFOPLIST_FILE = YYInfiniteScrollView/Info.plist; 363 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 365 | OTHER_LDFLAGS = ( 366 | "-ObjC", 367 | "-lz", 368 | "-framework", 369 | Reveal, 370 | ); 371 | PRODUCT_BUNDLE_IDENTIFIER = com.baozou.BaoZouTVHD; 372 | PRODUCT_NAME = "$(TARGET_NAME)"; 373 | PROVISIONING_PROFILE = ""; 374 | }; 375 | name = Release; 376 | }; 377 | /* End XCBuildConfiguration section */ 378 | 379 | /* Begin XCConfigurationList section */ 380 | 193D90021C1E908C00E70C07 /* Build configuration list for PBXProject "YYInfiniteScrollView" */ = { 381 | isa = XCConfigurationList; 382 | buildConfigurations = ( 383 | 193D901C1C1E908C00E70C07 /* Debug */, 384 | 193D901D1C1E908C00E70C07 /* Release */, 385 | ); 386 | defaultConfigurationIsVisible = 0; 387 | defaultConfigurationName = Release; 388 | }; 389 | 193D901E1C1E908C00E70C07 /* Build configuration list for PBXNativeTarget "YYInfiniteScrollView" */ = { 390 | isa = XCConfigurationList; 391 | buildConfigurations = ( 392 | 193D901F1C1E908C00E70C07 /* Debug */, 393 | 193D90201C1E908C00E70C07 /* Release */, 394 | ); 395 | defaultConfigurationIsVisible = 0; 396 | defaultConfigurationName = Release; 397 | }; 398 | /* End XCConfigurationList section */ 399 | }; 400 | rootObject = 193D8FFF1C1E908C00E70C07 /* Project object */; 401 | } 402 | -------------------------------------------------------------------------------- /YYInfiniteScrollView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YYInfiniteScrollView.xcodeproj/project.xcworkspace/xcuserdata/various.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView.xcodeproj/project.xcworkspace/xcuserdata/various.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /YYInfiniteScrollView.xcodeproj/xcuserdata/various.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /YYInfiniteScrollView.xcodeproj/xcuserdata/various.xcuserdatad/xcschemes/YYInfiniteScrollView.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 | -------------------------------------------------------------------------------- /YYInfiniteScrollView.xcodeproj/xcuserdata/various.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | YYInfiniteScrollView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 193D90061C1E908C00E70C07 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // Copyright © 2015年 Baozou. 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 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // Copyright © 2015年 Baozou. 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 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "size" : "29x29", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "size" : "29x29", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "40x40", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "40x40", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "76x76", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "76x76", 31 | "scale" : "2x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /YYInfiniteScrollView/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 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/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~ipad 34 | 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Reveal: -------------------------------------------------------------------------------- 1 | Versions/Current/Reveal -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Versions/A/Headers/IBANetServiceTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 Itty Bitty Apps Pty Ltd. All rights reserved. 3 | 4 | #ifndef reveal_core_IBANetServiceTypes_h 5 | #define reveal_core_IBANetServiceTypes_h 6 | #import 7 | 8 | typedef NS_ENUM(uint32_t, IBANetServiceInterface) { 9 | IBANetServiceInterfaceAny = kDNSServiceInterfaceIndexAny, 10 | IBANetServiceInterfaceLocalOnly = kDNSServiceInterfaceIndexLocalOnly, 11 | IBANetServiceInterfaceUnicast = kDNSServiceInterfaceIndexUnicast, 12 | IBANetServiceInterfaceP2P = kDNSServiceInterfaceIndexP2P 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Versions/A/Headers/IBARevealLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 Itty Bitty Apps. All rights reserved. 3 | 4 | #import 5 | 6 | extern NSString * const IBARevealLoaderRequestStartNotification; 7 | extern NSString * const IBARevealLoaderRequestStopNotification; 8 | 9 | extern NSString * const IBARevealLoaderSetOptionsNotification; 10 | extern NSString * const IBARevealLoaderOptionsLogLevelMaskKey; 11 | 12 | @interface IBARevealLoader : NSObject 13 | 14 | + (void)startServer; 15 | + (void)stopServer; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Versions/A/Headers/IBARevealLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved. 2 | // 3 | 4 | #import 5 | 6 | CF_EXTERN_C_BEGIN 7 | 8 | /*! 9 | \brief The Reveal Log level bit flags. 10 | \discussion These flags are additive. i.e. you should bitwise OR them together. 11 | 12 | \seealso IBARevealLoggerSetLevelMask 13 | \seealso IBARevealLoggerGetLevelMask 14 | 15 | Example: 16 | 17 | // Enable Error, Warning and Info logger levels. 18 | IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo); 19 | 20 | */ 21 | typedef NS_OPTIONS(int32_t, IBARevealLogLevel) 22 | { 23 | IBARevealLogLevelNone = 0, 24 | IBARevealLogLevelDebug = (1 << 0), 25 | IBARevealLogLevelInfo = (1 << 1), 26 | IBARevealLogLevelWarn = (1 << 2), 27 | IBARevealLogLevelError = (1 << 3) 28 | }; 29 | 30 | /*! 31 | \brief Set the Reveal logger level mask. 32 | \param mask A bit mask which is a combination of the IBARevealLogLevel enum options. 33 | 34 | \discussion If you do not wish to see log messages from Reveal you should call this function with an appropriate level mask as early in your application's lifecycle as possible. For example in your application's main() function. 35 | 36 | Example: 37 | 38 | // Enable Error, Warning and Info logger levels. 39 | IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo); 40 | 41 | */ 42 | CF_EXPORT void IBARevealLoggerSetLevelMask(int32_t mask); 43 | 44 | /*! 45 | \brief Get the current Reveal logger level mask. 46 | \return A bit mask representing the levels at which Reveal is currently logging. 47 | \discussion The default Reveal Logger level mask is IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo. 48 | 49 | Example: 50 | 51 | // Turn off the Info log level. 52 | IBARevealLoggerSetLevelMask(IBARevealLoggerGetLevelMask() & ~IBARevealLogLevelInfo); 53 | 54 | */ 55 | CF_EXPORT int32_t IBARevealLoggerGetLevelMask(void); 56 | 57 | CF_EXTERN_C_END 58 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Versions/A/Headers/Reveal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved. 2 | // 3 | 4 | #import "IBARevealLogger.h" 5 | #import "IBARevealLoader.h" 6 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Versions/A/Reveal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView/Reveal.framework/Versions/A/Reveal -------------------------------------------------------------------------------- /YYInfiniteScrollView/Reveal.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /YYInfiniteScrollView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // Copyright © 2015年 Baozou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YYInfiniteScrollView.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @property (nonatomic, strong) YYInfiniteScrollView *infiniteScrollView; 15 | 16 | @property (nonatomic, strong) NSTimer *timer; 17 | 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // Copyright © 2015年 Baozou. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "DetailViewController.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)dealloc{ 19 | [self.timer invalidate]; 20 | self.timer = nil; 21 | } 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | self.title = @"YYInfiniteScrollView"; 26 | self.infiniteScrollView = [[YYInfiniteScrollView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 260) contentSpacing:10]; 27 | self.infiniteScrollView.delegate = self; 28 | self.infiniteScrollView.pageSize = CGSizeMake(535, 260); 29 | NSMutableArray *imageViews = [[NSMutableArray alloc] init]; 30 | for (int i = 1; i <= 6; ++i) { 31 | UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"page%d.jpg", i]]; 32 | UIImageView *page = [[UIImageView alloc] initWithImage:image]; 33 | page.frame = CGRectMake(0.f, 0.f, 535, 260); 34 | page.contentMode = UIViewContentModeScaleAspectFill; 35 | UILabel *label = [[UILabel alloc] init]; 36 | label.text = [NSString stringWithFormat:@"%d",i]; 37 | label.frame = CGRectMake(0, 0, 100, 100); 38 | label.font = [UIFont fontWithName:@"Helvetica" size:100]; 39 | label.textAlignment = NSTextAlignmentCenter; 40 | [label setTextColor:[UIColor whiteColor]]; 41 | label.center = page.center; 42 | [page addSubview:label]; 43 | [imageViews addObject:page]; 44 | } 45 | [self.infiniteScrollView addPageViews:imageViews]; 46 | [self.view addSubview:self.infiniteScrollView]; 47 | 48 | self.timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(scrollPageView) userInfo:nil repeats:YES]; 49 | [self.timer setFireDate:[NSDate distantPast]]; 50 | 51 | } 52 | 53 | - (void)scrollPageView{ 54 | [self.infiniteScrollView scrollToPreviousPage]; 55 | } 56 | 57 | 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | 64 | #pragma mark YYInfiniteScrollViewDelegate 65 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didClickIndex:(int)index{ 66 | DetailViewController *detail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; 67 | detail.imageName = [NSString stringWithFormat:@"page%d.jpg", index + 1]; 68 | [self.navigationController pushViewController:detail animated:YES]; 69 | } 70 | 71 | 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/YYInfiniteScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YYInfiniteScrollView.h 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // 7 | 8 | /* 9 | The MIT License (MIT) 10 | 11 | Copyright (c) 2015 various 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | THE SOFTWARE. 30 | */ 31 | 32 | 33 | 34 | #import 35 | 36 | 37 | @class YYInfiniteScrollView; 38 | 39 | /*! 40 | @protocol YYInfiniteScrollViewDelegate 41 | */ 42 | @protocol YYInfiniteScrollViewDelegate 43 | @optional 44 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView willBeginDragging:(UIScrollView *)scrollView; 45 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didScroll:(UIScrollView *)scrollView; 46 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didEndDragging:(UIScrollView *)scrollView; 47 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView willBeginDecelerating:(UIScrollView *)scrollView; 48 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didEndDecelerating:(UIScrollView *)scrollView ; 49 | - (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didClickIndex:(int)index; 50 | @end 51 | 52 | /*! 53 | * @class YYInfiniteScrollView 54 | * endlessly scrollable view. 55 | */ 56 | @interface YYInfiniteScrollView : UIView 57 | 58 | /*! 59 | @var CGFloat width of inner page. 60 | */ 61 | @property (nonatomic, assign) CGSize pageSize; 62 | 63 | 64 | 65 | /*! 66 | @var YYInfiniteScrollViewDelegate 67 | */ 68 | @property (nonatomic, assign) id delegate; 69 | 70 | - (void)setPageSize:(CGSize)pageSize; 71 | 72 | - (id)initWithFrame:(CGRect)frame contentSpacing:(float)contentSpacing; 73 | 74 | - (void)addPageViews:(NSArray *)pageView; 75 | 76 | /*! 77 | Scroll to previous page. 78 | @method scrollToPrevious 79 | */ 80 | - (void)scrollToPreviousPage; 81 | 82 | /*! 83 | Scroll to next page. 84 | @method scrollToPrevious 85 | */ 86 | - (void)scrollToNextPage; 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/YYInfiniteScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // YYInfiniteScrollView.m 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // 7 | 8 | /* 9 | The MIT License (MIT) 10 | 11 | Copyright (c) 2015 various 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | THE SOFTWARE. 30 | */ 31 | 32 | 33 | #import "YYInfiniteScrollView.h" 34 | 35 | 36 | @interface YYInfiniteScrollView (){ 37 | UIScrollView *_innerScrollView; 38 | NSMutableArray *_pageViews; 39 | CGFloat _previousScrollViewOffsetX; 40 | float _contentSpacing; 41 | 42 | } 43 | @end 44 | 45 | 46 | @implementation YYInfiniteScrollView 47 | 48 | 49 | - (id)initWithFrame:(CGRect)frame contentSpacing:(float)contentSpacing { 50 | self = [super init]; 51 | if (self) { 52 | self.frame = frame; 53 | _contentSpacing = contentSpacing; 54 | self.userInteractionEnabled = YES; 55 | self.clipsToBounds = YES; 56 | CGRect bounds = CGRectZero; 57 | bounds.size = frame.size; 58 | _innerScrollView = [[UIScrollView alloc] initWithFrame:bounds]; 59 | _innerScrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight); 60 | _innerScrollView.delegate = self; 61 | _innerScrollView.backgroundColor = [UIColor clearColor]; 62 | _innerScrollView.clipsToBounds = NO; 63 | _innerScrollView.pagingEnabled = YES; 64 | _innerScrollView.scrollEnabled = YES; 65 | _innerScrollView.showsHorizontalScrollIndicator = NO; 66 | _innerScrollView.showsVerticalScrollIndicator = NO; 67 | _innerScrollView.scrollsToTop = NO; 68 | _innerScrollView.backgroundColor = [UIColor whiteColor]; 69 | [self addSubview:_innerScrollView]; 70 | UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self 71 | action:@selector(handleSingleFingerEvent:)]; 72 | singleFingerOne.numberOfTouchesRequired = 1; 73 | singleFingerOne.numberOfTapsRequired = 1; 74 | singleFingerOne.delegate = self; 75 | [self addGestureRecognizer:singleFingerOne]; 76 | 77 | } 78 | return self; 79 | } 80 | 81 | - (void)scrollPageView{ 82 | 83 | } 84 | 85 | 86 | - (void)handleSingleFingerEvent:(UITapGestureRecognizer *)tapRecognizer{ 87 | int clickIndex = 0; 88 | CGPoint touchPoint = [tapRecognizer locationInView: self]; 89 | NSArray *subViews = _innerScrollView.subviews; 90 | if (touchPoint.x < ([UIScreen mainScreen].bounds.size.width - self.pageSize.width)/2.0) { 91 | if(self.delegate && [self.delegate respondsToSelector:@selector(infiniteScrollView:didClickIndex:)]){ 92 | for (UIView *page in subViews) { 93 | if ([page isKindOfClass:[UIView class]]) { 94 | if (page.center.x == (0) * (_innerScrollView.frame.size.width) + (_innerScrollView.frame.size.width / 2)) { 95 | clickIndex = (int)page.tag; 96 | [self.delegate infiniteScrollView:self didClickIndex:clickIndex]; 97 | return; 98 | } 99 | } 100 | } 101 | } 102 | }else if (touchPoint.x > ([UIScreen mainScreen].bounds.size.width - self.pageSize.width)/2.0 + self.pageSize.width){ 103 | if(self.delegate && [self.delegate respondsToSelector:@selector(infiniteScrollView:didClickIndex:)]){ 104 | for (UIView *page in subViews) { 105 | if ([page isKindOfClass:[UIView class]]) { 106 | if (page.center.x == (2) * (_innerScrollView.frame.size.width) + (_innerScrollView.frame.size.width / 2)) { 107 | clickIndex = (int)page.tag; 108 | [self.delegate infiniteScrollView:self didClickIndex:clickIndex]; 109 | return; 110 | } 111 | } 112 | } 113 | } 114 | }else{ 115 | if(self.delegate && [self.delegate respondsToSelector:@selector(infiniteScrollView:didClickIndex:)]){ 116 | for (UIView *page in subViews) { 117 | if ([page isKindOfClass:[UIView class]]) { 118 | if (page.center.x == (1) * (_innerScrollView.frame.size.width) + (_innerScrollView.frame.size.width / 2)) { 119 | clickIndex = (int)page.tag; 120 | [self.delegate infiniteScrollView:self didClickIndex:clickIndex]; 121 | return; 122 | } 123 | } 124 | } 125 | } 126 | } 127 | } 128 | 129 | - (void)dealloc 130 | { 131 | 132 | _innerScrollView.delegate = nil; 133 | } 134 | 135 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event 136 | { 137 | UIView *hitView = [super hitTest:point withEvent:event]; 138 | if (nil != hitView) { 139 | return _innerScrollView; 140 | } 141 | return nil; 142 | } 143 | 144 | #pragma mark - Public methods 145 | 146 | - (void)addPageViews:(NSArray *)pageViews{ 147 | for (int i = 0; i < pageViews.count; i++) { 148 | UIView *view = [pageViews objectAtIndex:i]; 149 | view.tag = i; 150 | } 151 | if (nil == _pageViews) { 152 | _pageViews = [NSMutableArray array]; 153 | } 154 | [_pageViews removeAllObjects]; 155 | NSArray *scrollViewSubViews = [_innerScrollView subviews]; 156 | [scrollViewSubViews makeObjectsPerformSelector:@selector(removeFromSuperview)]; 157 | [_pageViews addObjectsFromArray:pageViews]; 158 | 159 | for (int i = 0; i < 3; i ++) { 160 | UIView *rightView = [_pageViews lastObject]; 161 | [_pageViews removeLastObject]; 162 | [_pageViews insertObject:rightView atIndex:0]; 163 | } 164 | [self layoutPages]; 165 | } 166 | 167 | - (void)scrollToPreviousPage 168 | { 169 | [self scrollToDirection:1 animated:YES]; 170 | [self performSelector:@selector(scrollViewDidEndDecelerating:) withObject:_innerScrollView afterDelay:0.5f]; // delay until scroll animation end. 171 | } 172 | 173 | - (void)scrollToNextPage 174 | { 175 | [self scrollToDirection:-1 animated:YES]; 176 | [self performSelector:@selector(scrollViewDidEndDecelerating:) withObject:_innerScrollView afterDelay:0.5f]; // delay until scroll animation end. 177 | } 178 | 179 | - (void)layoutSubviews { 180 | [super layoutSubviews]; 181 | [self layoutPages]; 182 | } 183 | 184 | - (void)setPageSize:(CGSize)pageSize{ 185 | _pageSize = CGSizeMake(pageSize.width + _contentSpacing, pageSize.height); 186 | } 187 | 188 | #pragma mark - Private methods 189 | - (void)layoutPages 190 | { 191 | CGFloat left_margin = (self.frame.size.width - _pageSize.width) / 2; 192 | _innerScrollView.frame = CGRectMake(left_margin, 0.f, _pageSize.width , self.frame.size.height); 193 | _innerScrollView.contentSize = CGSizeMake(_pageViews.count * _innerScrollView.frame.size.width + (_pageViews.count - 1) * _contentSpacing, self.frame.size.height); 194 | for (int idx = 0; idx < _pageViews.count ; idx++) { 195 | UIView *pageView = [_pageViews objectAtIndex:idx]; 196 | pageView.center = CGPointMake((idx - 2) * (_innerScrollView.frame.size.width) + (_innerScrollView.frame.size.width / 2) , _innerScrollView.center.y); 197 | [_innerScrollView addSubview:pageView]; 198 | } 199 | _innerScrollView.contentOffset = CGPointMake(_pageSize.width , 0.f); 200 | } 201 | 202 | - (void)scrollToDirection:(NSInteger)moveDirection animated:(BOOL)animated 203 | { 204 | CGRect adjustScrollRect; 205 | if (0 != fmodf(_innerScrollView.contentOffset.x, _pageSize.width)) return ; 206 | adjustScrollRect = CGRectMake(_innerScrollView.contentOffset.x - _innerScrollView.frame.size.width * moveDirection, 207 | _innerScrollView.contentOffset.y, 208 | _innerScrollView.frame.size.width, _innerScrollView.frame.size.height); 209 | [_innerScrollView scrollRectToVisible:adjustScrollRect animated:animated]; 210 | } 211 | 212 | #pragma mark - UIScrollViewDelegate methods 213 | - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView 214 | { 215 | _previousScrollViewOffsetX = scrollView.contentOffset.x; 216 | if (self.delegate != nil && [self.delegate respondsToSelector:@selector(infiniteScrollView:willBeginDragging:)]) { 217 | [self.delegate infiniteScrollView:self willBeginDragging:_innerScrollView]; 218 | } 219 | } 220 | 221 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 222 | { 223 | if (self.delegate != nil && [self.delegate respondsToSelector:@selector(infiniteScrollView:didScroll:)]) { 224 | [self.delegate infiniteScrollView:self didScroll:_innerScrollView]; 225 | } 226 | } 227 | 228 | - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate 229 | { 230 | if (self.delegate != nil && [self.delegate respondsToSelector:@selector(infiniteScrollView:didEndDragging:)]) { 231 | [self.delegate infiniteScrollView:self didEndDragging:_innerScrollView]; 232 | } 233 | } 234 | 235 | - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView 236 | { 237 | if (self.delegate != nil && [self.delegate respondsToSelector:@selector(infiniteScrollView:willBeginDecelerating:)]) { 238 | [self.delegate infiniteScrollView:self willBeginDecelerating:_innerScrollView]; 239 | } 240 | } 241 | 242 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView 243 | { 244 | if (scrollView.contentOffset.x == 0) { 245 | //move to right 246 | UIView *rightView = [_pageViews lastObject]; 247 | [_pageViews removeLastObject]; 248 | [_pageViews insertObject:rightView atIndex:0]; 249 | 250 | }else if(scrollView.contentOffset.x == _pageSize.width * 2 ){ 251 | UIView *leftView = [_pageViews objectAtIndex:0]; 252 | [_pageViews removeObjectAtIndex:0]; 253 | [_pageViews insertObject:leftView atIndex:_pageViews.count]; 254 | } 255 | for(int idx = 0;idx < _pageViews.count; idx++){ 256 | UIView *pageView = [_pageViews objectAtIndex:idx]; 257 | pageView.center = CGPointMake((idx - 2 ) * _innerScrollView.frame.size.width + _innerScrollView.frame.size.width / 2 , _innerScrollView.center.y); 258 | } 259 | _innerScrollView.contentOffset = CGPointMake(_pageSize.width , 0.f); 260 | } 261 | 262 | @end 263 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/DetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.h 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // Copyright © 2015年 Baozou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DetailViewController : UIViewController 12 | 13 | @property (weak, nonatomic) IBOutlet UIImageView *detailImageView; 14 | 15 | @property (strong, nonatomic) NSString *imageName; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/DetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.m 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // Copyright © 2015年 Baozou. All rights reserved. 7 | // 8 | 9 | #import "DetailViewController.h" 10 | 11 | @interface DetailViewController () 12 | 13 | @end 14 | 15 | @implementation DetailViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | UIImage *image = [UIImage imageNamed:self.imageName]; 20 | self.detailImageView.image = image; 21 | self.view.backgroundColor = [UIColor whiteColor]; 22 | } 23 | 24 | - (void)didReceiveMemoryWarning { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/DetailViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/Resources/page1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView/class/Resources/page1.jpg -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/Resources/page2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView/class/Resources/page2.jpg -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/Resources/page3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView/class/Resources/page3.jpg -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/Resources/page4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView/class/Resources/page4.jpg -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/Resources/page5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView/class/Resources/page5.jpg -------------------------------------------------------------------------------- /YYInfiniteScrollView/class/Resources/page6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/YYInfiniteScrollView/class/Resources/page6.jpg -------------------------------------------------------------------------------- /YYInfiniteScrollView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // YYInfiniteScrollView 4 | // 5 | // Created by various on 15/12/14. 6 | // Copyright © 2015年 Baozou. 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 | -------------------------------------------------------------------------------- /sample1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/sample1.png -------------------------------------------------------------------------------- /sample2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/various/YYInfiniteScrollView/30cc2a44c18a8040a0dc6ff0ac2b04d64a33014b/sample2.png --------------------------------------------------------------------------------