Coder Social home page Coder Social logo

pagingview's Introduction

LOGO

Carthage compatible Version License Platform

Infinite paging, Smart auto layout, Interface of similar to UIKit.

Demo

Requirements

  • swift 2.0

How to Install PagingView

iOS 8+

Cocoapods

Add the following to your Podfile:

use_frameworks!
pod "PagingView"

Note: the use_frameworks! is required for pods made in Swift.

Carthage

Add the following to your Cartfile:

github "KyoheiG3/PagingView"

iOS 7

Just add everything in the PagingView.swift, PagingViewCell.swift and Constraints.swift file to your project.

Usage

import

If target is ios8.0 or later, please import the PagingView.

import PagingView

PagingView Variable

weak var dataSource: PagingViewDataSource?
  • DataSource of PagingView. Same as dataSource of UICollectionView.
var pagingMargin: UInt
  • Margin between the content.
  • Default is 0.
var pagingInset: UInt
  • Inset of content relative to size of PagingView.
  • Value of two times than of pagingInset to set for the left and right of contentInset.
  • Default is 0.

PagingView Function

func dequeueReusableCellWithReuseIdentifier(identifier: String) -> PagingView.PagingViewCell
  • Used by the delegate to acquire an already allocated cell, in lieu of allocating a new one.
func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
  • If a nib is registered, it must contain exactly 1 top level object which is a PagingViewCell.
func registerClass<T : PagingView.PagingViewCell>(viewClass: T.Type, forCellWithReuseIdentifier identifier: String)
  • If a class is registered, it will be instantiated via init(frame: CGRect).
func reloadData()
  • Requery the dataSource and delegate as necessary.
func numberOfSections() -> Int
func numberOfItemsInSection(section: Int) -> Int
  • Information about the current state of the PagingView.
func scrollToPosition(position: PagingView.PagingView.Position, indexPath: NSIndexPath? = default, animated: Bool = default)
  • To scroll at Position.
  • Cell configure is performed at NSIndexPath.
func configureAtPosition(position: PagingView.PagingView.Position, toIndexPath: NSIndexPath? = default)
  • Configure cell of Position.
  • IndexPath of cell in the center if indexPath is nil.

PagingViewDataSource Function

func pagingView(pagingView: PagingView.PagingView, numberOfItemsInSection section: Int) -> Int
  • Paging count number of paging item in section.
func pagingView(pagingView: PagingView.PagingView, cellForItemAtIndexPath indexPath: NSIndexPath) -> PagingView.PagingViewCell
  • Implementers should always try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithReuseIdentifier:.
optional func numberOfSectionsInPagingView(pagingView: PagingView.PagingView) -> Int
  • Paging count number of paging item section in PagingView.
  • Default return value is 1.
optional func indexPathOfStartingInPagingView(pagingView: PagingView.PagingView) -> NSIndexPath?
  • IndexPath when pagingView:cellForItemAtIndexPath: is first called
  • Default return value is 0 - 0 of NSIndexPath instance.

PagingViewDelegate Function

optional func pagingView(pagingView: PagingView.PagingView, willDisplayCell cell: PagingView.PagingViewCell, forItemAtIndexPath indexPath: NSIndexPath)
optional func pagingView(pagingView: PagingView.PagingView, didEndDisplayingCell cell: PagingView.PagingViewCell, forItemAtIndexPath indexPath: NSIndexPath)
  • Called at the display and end-display of.

PagingViewCell Function

func prepareForReuse()
  • if the cell is reusable (has a reuse identifier), this is called just before the cell is returned from the paging view method dequeueReusableCellWithReuseIdentifier:.

LICENSE

Under the MIT license. See LICENSE file for details.

pagingview's People

Contributors

kyoheig3 avatar

Watchers

Chew Chit Siang avatar James Cloos 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.