Latest 1.0.3
Homepage https://github.com/wuwen1030/XTInfiniteScrollView
License MIT
Platforms ios 6.0, requires ARC
Dependencies AFNetworking
Authors

gif

Initialization

You can either init a inifinite scroll view with code, xib or storyboard.

Data Source

Data source is very similar to UITableViewDataSource. Implemention of protocols in XTInfiniteScrollViewDataSource.

#pragma mark - XTInfiniteScrollViewDataSource

- (NSUInteger)numberOfImagesInInfiniteScrollView:(XTInfiniteScrollView *)infiniteScrollView
{
    return self.imageURLs.count;
}

- (NSURL *)infiniteScrollView:(XTInfiniteScrollView *)infiniteScrollView urlForImageAtIndex:(NSUInteger)index
{
    return self.imageURLs[index];
}

- (UIImage *)infiniteScrollView:(XTInfiniteScrollView *)infiniteScrollView placeholderForImageAtIndex:(NSUInteger)index
{
    return self.placeholderImages[index];
}

If the showing images are from network, do implement

- (UIImage *)infiniteScrollView:(XTInfiniteScrollView *)infiniteScrollView placeholderForImageAtIndex:(NSUInteger)index

Delegate

You should know which image the users have clicked, when you want to show a detail view. And maybe you will also need a page control to indicate which image is showing.

#pragma mark - XTInfiniteScrollViewDelegate

- (void)infiniteScrollView:(XTInfiniteScrollView *)infiniteScrollView didSelectImageAtIndex:(NSUInteger)index
{
    NSLog(@"Select image at index:%ld", (long)index);
}

- (void)infiniteScrollView:(XTInfiniteScrollView *)infiniteScrollView didShowImageAtIndex:(NSUInteger)index
{
    NSLog(@"Did show image at index:%ld", (long)index);
}

Usage

pod 'XTInfiniteScrollView' ~> '1.0.1'

Latest podspec

{
    "name": "XTInfiniteScrollView",
    "version": "1.0.3",
    "summary": "An elegant infinite scroll view for ad banner.",
    "description": "Data source is very similar to UITableViewDataSource. Implement protocols in XTInfiniteScrollViewDataSource.",
    "homepage": "https://github.com/wuwen1030/XTInfiniteScrollView",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "XiaBin": "[email protected]"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/wuwen1030/XTInfiniteScrollView.git",
        "tag": "1.0.3"
    },
    "source_files": "XTInfiniteScrollView/XTInfiniteScrollView/*.{h,m}",
    "requires_arc": true,
    "dependencies": {
        "AFNetworking": []
    }
}

Pin It on Pinterest

Share This