Skip to content

YYInfiniteScrollView is a infinite scrollview that imitate iPad AppStore(app store appstore apple ) homepage scrollview effect. infinitescrollview infinite scrollview

Notifications You must be signed in to change notification settings

various/YYInfiniteScrollView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YYInfiniteScrollView

Overview

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.

Features

  • Endlessly scrollable to horizontal direction and show the previous and next subview.
  • Each page view contents are available to a UIView based custom view.
  • Implements paging scroll and click delegate protocol.
  • Page scroll action methods.
  • Page click action methods.

Requirements

  • iOS 7.0+
  • Xcode 5 (Use ARC)

Screenshots

Screenshot0 Screenshot0

How to use

#import "YYInfiniteScrollView.h"
...
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"YYInfiniteScrollView";
    self.infiniteScrollView = [[YYInfiniteScrollView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 260) contentSpacing:10];
    self.infiniteScrollView.delegate = self;
    self.infiniteScrollView.pageSize = CGSizeMake(535, 260);
    NSMutableArray *imageViews = [[NSMutableArray alloc] init];
    for (int i = 1; i <= 6; ++i) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"page%d.jpg", i]];
        UIImageView *page = [[UIImageView alloc] initWithImage:image];
        page.frame = CGRectMake(0.f, 0.f, 535, 260);
        page.contentMode = UIViewContentModeScaleAspectFill;
        UILabel *label = [[UILabel alloc] init];
        label.text = [NSString stringWithFormat:@"%d",i];
        label.frame = CGRectMake(0, 0, 100, 100);
        label.font = [UIFont fontWithName:@"Helvetica" size:100];
        label.textAlignment = NSTextAlignmentCenter;
        [label setTextColor:[UIColor whiteColor]];
        label.center = page.center;
        [page addSubview:label];
        [imageViews addObject:page];
    }
    [self.infiniteScrollView addPageViews:imageViews];
    [self.view addSubview:self.infiniteScrollView];
}

Build and run the project files. Enjoy more examples!

Public methods

- (void)addPageViews:(NSArray *)pageView;

Adds views to the inner scrollview's subviews.

- (void)scrollToPreviousPage;

Scroll to the previous page.

- (void)scrollToNextPage;

Scroll to the next page.

YYInfiniteScrollViewDelegate Protocols

- (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didClickIndex:(int)index;

Tells the delegate when the paging view is cilcked.

- (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView willBeginDragging:(UIScrollView *)scrollView;

Tells the delegate when the paging view is about to start scrolling the content.

- (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didScroll:(UIScrollView *)scrollView;

Tells the delegate when the user scrolls the content view within the receiver.

- (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didEndDragging:(UIScrollView *)scrollView;

Tells the delegate when dragging ended in the paging view.

- (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView willBeginDecelerating:(UIScrollView *)scrollView;

Tells the delegate that the paging view is starting to decelerate the scrolling movement.

- (void)infiniteScrollView:(YYInfiniteScrollView *)infiniteScrollView didEndDecelerating:(UIScrollView *)scrollView ;

Tells the delegate that the scroll view has ended decelerating the scrolling movement.

License

This software is released under the MIT License, see LICENSE.txt.

About

YYInfiniteScrollView is a infinite scrollview that imitate iPad AppStore(app store appstore apple ) homepage scrollview effect. infinitescrollview infinite scrollview

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published