GTCyclePageView 1.0.0

GTCyclePageView 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • gongtao

GTCyclePageView is a view that can circularly scroll pages. The way that GTCyclePageView uses datasource to load each page view is almost the same way as UITableView.

It's based on UIScrollView, and its delegate inherit from UIScrollViewDelegate.

How to get started?

GTCyclePageViewDataSource

Use GTCyclePageViewDataSource to load page contents. GTCyclePageViewCell is a sub class of UIView. You can add subViews to GTCyclePageViewCell object, or write your own page content view that inherits from GTCyclePageViewCell class.

- (NSUInteger)numberOfPagesInCyclePageView:(GTCyclePageView *)cyclePageView
{
    return 5;
}

- (GTCyclePageViewCell *)cyclePageView:(GTCyclePageView *)cyclePageView index:(NSUInteger)index
{
    static NSString *cellIdentifier = @"cellIdentifier";
    GTCyclePageViewCell *cell = [cyclePageView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[GTCyclePageViewCell alloc] initWithReuseIdentifier:cellIdentifier];
    }

    //Customize cell here...

    return cell;
}

GTCyclePageViewDelegate

GTCyclePageViewDelegate inherit from UIScrollViewDelegate. The below method is called when the page changes.

- (void)didPageChangedCyclePageView:(GTCyclePageView *)cyclePageView

The below method is called when a displayed cell is tapped.

- (void)cyclePageView:(GTCyclePageView *)cyclePageView didTouchCellAtIndex:(NSUInteger)index

Others

Return the GTCyclePageViewCell object from unusable array by cellIdentifier.

- (GTCyclePageViewCell *)dequeueReusableCellWithIdentifier:(NSString *)cellIdentifier;

Scroll to next or pre page.

- (void)scrollToNextPage:(BOOL)animated;

- (void)scrollToPrePage:(BOOL)animated;

The current page of GTCyclePageViewCell object. Set it to change page.

@property (nonatomic, assign) NSUInteger currentPage;

Contact

龚涛 Gong Tao mail: [email protected]