Latest 1.2.0
Homepage https://github.com/hirohisa/DCScrollView
License MIT
Platforms ios , requires ARC
Authors

DCScrollView Build Status

DCScrollView is an extension of UIScrollView that scrolling through the content, the title scrolls with a delay like Etsy app for iOS.

![sample](DCScrollView Example/sample.gif)

Requirements

  • iOS 4.3+
  • ARC

If your project’s target is iOS 8.0+, use PageController. PageController has high performance than DCScrollView. DCScrollView controls [UIView], PageController controls [UIViewController].

Used in Production

![ ](DCScrollView Example/yafuoku.png)

Installation

There are two ways to use this in your project:

  • Copy DCScrollView/*.{h.m} into your project

  • Install with CocoaPods to write Podfile
    platform :ios
    pod 'DCScrollView'

Usage

Set Delegate, DataSource

DCScrollView uses a simple methodology. It defines a delegate and a data source, its client implement.
DCScrollViewDelegate and DCScrollViewDataSource are like UITableViewDelegate and UITableViewDatasource.

Reload

Reset cells and redisplays visible cells. Current page keep visible after reloading.

- (void)reloadData;

Remove Cache

If UIViewController received memory warnings, control to clear the memory that DCScrollView has.

- (void)clearData;

Example

  • import DCScrollView.h
  • implement DCScrollViewDataSource and DCScrollViewDelegate‘s methods

UIViewController


#import "DCScrollView.h"

@interface ExampleViewController ()

<DCScrollViewDataSource, DCScrollViewDelegate>

@end

@implementation ExampleViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    DCScrollView *scrollView = [[DCScrollView alloc]initWithFrame:self.view.bounds];
    scrollView.dataSource = self;
    scrollView.delegate = self;
}

- (NSInteger)numberOfCellsInDCScrollView:(DCScrollView *)scrollView
{
    return 10;
}

- (DCScrollViewCell *)dcscrollView:(DCScrollView *)scrollView cellAtIndex:(NSInteger)index
{
    NSString *identifier = @"Cell";
    DCScrollViewCell *cell = [scrollView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell  = [[DCScrollViewCell alloc] initWithReuseIdentifier:identifier];
    }

    return cell;
}

- (NSString *)titleOfDCScrollViewCellAtIndex:(NSInteger)index
{
    return @"title";
}

License

DCScrollView is available under the MIT license.

Latest podspec

{
    "name": "DCScrollView",
    "version": "1.2.0",
    "summary": "DCScrollView is an extension of UIScrollView that scrolling through the content, the title scrolls with a delay like Etsy app for iOS.",
    "homepage": "https://github.com/hirohisa/DCScrollView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Hirohisa Kawasaki": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hirohisa/DCScrollView.git",
        "tag": "1.2.0"
    },
    "platforms": {
        "ios": null
    },
    "source_files": "DCScrollView",
    "requires_arc": true
}

Pin It on Pinterest

Share This