Giter Site home page Giter Site logo

iliuchang / lcinfinitescrollview Goto Github PK

View Code? Open in Web Editor NEW
185.0 5.0 6.0 768 KB

An infinite-scroll banner implemented with two views, includes Swift and Objective-C APIs.

License: MIT License

Ruby 3.46% Objective-C 54.53% Swift 42.01%
objective-c banner infinite-scroll ios swift uiscrollview

lcinfinitescrollview's Introduction

LCInfiniteScrollView

An infinite scroll control implemented with two views, supporting custom reuse of views.

infinite-scroll

Requirements

  • Objective-C

    • iOS 8.0+
  • Swift

    • iOS 9.0+
    • Swift 4.0+

Features

  • Supports infinite scrolling.
  • Reuse with two views.
  • Support for custom reuse views.

Usage

Init

  • Objective-C
LCInfiniteScrollView *v = [[LCInfiniteScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 300)];
v.backgroundColor = UIColor.brownColor;
v.delegate = self;
v.autoScroll = YES;
[self.view addSubview:v];
  • Swift
let banner = LCInfiniteScrollView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 200))
banner.delegate = self
banner.autoScroll = true
self.view.addSubview(banner)

Custom reuse view

  • Objective-C
- (UIView *)reusableViewInInfiniteScrollView:(LCInfiniteScrollView *)infiniteScrollView {
    UILabel *label = [UILabel new];
    label.font = [UIFont boldSystemFontOfSize:30];
    label.textAlignment = NSTextAlignmentCenter;
    return label;
}

- (void)infiniteScrollView:(LCInfiniteScrollView *)infiniteScrollView displayReusableView:(UIView *)reusableView atIndex:(NSInteger)index {
    UILabel *label = (UILabel *)reusableView;
    label.text = @(index).stringValue;
    label.backgroundColor = (UIColor *)self.colors[index];
}
  • Swift
func infiniteScrollView(_ infiniteScrollView: LCInfiniteScrollView, displayReusableView view: UIView, forIndex index: Int) {
    view.backgroundColor = colors[index]
}

func reusableView(in infiniteScrollView: LCInfiniteScrollView) -> UIView {
    return UIView()
}

Installation

CocoaPods

To integrate LCInfiniteScrollView into your Xcode project using CocoaPods, specify it in your Podfile:

  • Objective-C
pod 'LCInfiniteScrollView'
  • Swift
pod 'SwiftInfiniteScrollView'

Manual

  • Objective-C
  1. Download everything in the LCInfiniteScrollView folder;
  2. Add (drag and drop) the source files in LCInfiniteScrollView to your project.
  3. import LCInfiniteScrollView.h.
  • Swift
  1. Download everything in the LCInfiniteScrollView folder;
  2. Add (drag and drop) the source files in SwiftInfiniteScrollView to your project.

License

LCInfiniteScrollView is provided under the MIT license. See LICENSE file for details.

lcinfinitescrollview's People

Contributors

gly avatar iliuchang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.