Update documentation.
This commit is contained in:
parent
167c99e3d9
commit
f72e492bab
|
|
@ -1,7 +1,7 @@
|
|||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "FSPagerView"
|
||||
s.version = "0.1.1"
|
||||
s.version = "0.2.0"
|
||||
s.summary = "FSPagerView is an elegant Screen Slide Library for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders."
|
||||
|
||||
s.homepage = "https://github.com/WenchaoD/FSPagerView"
|
||||
|
|
|
|||
|
|
@ -142,6 +142,10 @@ open class FSPageControl: UIControl {
|
|||
}
|
||||
|
||||
/// Sets the stroke color for page indicators to use for the specified state. (selected/normal).
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - strokeColor: The stroke color to use for the specified state.
|
||||
/// - state: The state that uses the specified stroke color.
|
||||
@objc(setStrokeColor:forState:)
|
||||
open func setStrokeColor(_ strokeColor: UIColor?, for state: UIControlState) {
|
||||
guard self.strokeColors[state] != strokeColor else {
|
||||
|
|
@ -152,6 +156,10 @@ open class FSPageControl: UIControl {
|
|||
}
|
||||
|
||||
/// Sets the fill color for page indicators to use for the specified state. (selected/normal).
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - fillColor: The fill color to use for the specified state.
|
||||
/// - state: The state that uses the specified fill color.
|
||||
@objc(setFillColor:forState:)
|
||||
open func setFillColor(_ fillColor: UIColor?, for state: UIControlState) {
|
||||
guard self.fillColors[state] != fillColor else {
|
||||
|
|
@ -162,6 +170,10 @@ open class FSPageControl: UIControl {
|
|||
}
|
||||
|
||||
/// Sets the image for page indicators to use for the specified state. (selected/normal).
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - image: The image to use for the specified state.
|
||||
/// - state: The state that uses the specified image.
|
||||
@objc(setImage:forState:)
|
||||
open func setImage(_ image: UIImage?, for state: UIControlState) {
|
||||
guard self.images[state] != image else {
|
||||
|
|
@ -171,8 +183,13 @@ open class FSPageControl: UIControl {
|
|||
self.setNeedsUpdateIndicators()
|
||||
}
|
||||
|
||||
/// Sets the alpha value for page indicators to use for the specified state. (selected/normal).
|
||||
@objc(setAlpha:forState:)
|
||||
|
||||
/// Sets the alpha value for page indicators to use for the specified state. (selected/normal).
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - alpha: The alpha value to use for the specified state.
|
||||
/// - state: The state that uses the specified alpha.
|
||||
open func setAlpha(_ alpha: CGFloat, for state: UIControlState) {
|
||||
guard self.alphas[state] != alpha else {
|
||||
return
|
||||
|
|
@ -182,6 +199,10 @@ open class FSPageControl: UIControl {
|
|||
}
|
||||
|
||||
/// Sets the path for page indicators to use for the specified state. (selected/normal).
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - path: The path to use for the specified state.
|
||||
/// - state: The state that uses the specified path.
|
||||
@objc(setPath:forState:)
|
||||
open func setPath(_ path: UIBezierPath?, for state: UIControlState) {
|
||||
guard self.paths[state] != path else {
|
||||
|
|
|
|||
|
|
@ -187,12 +187,7 @@ class FSPagerViewLayout: UICollectionViewLayout {
|
|||
return frame
|
||||
}
|
||||
|
||||
// MARK:- Private functions
|
||||
|
||||
fileprivate func commonInit() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(didReceiveNotification(notification:)), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
|
||||
}
|
||||
|
||||
// MARK:- Notification
|
||||
@objc
|
||||
fileprivate func didReceiveNotification(notification: Notification) {
|
||||
if self.pagerView?.itemSize == .zero {
|
||||
|
|
@ -200,6 +195,12 @@ class FSPagerViewLayout: UICollectionViewLayout {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK:- Private functions
|
||||
|
||||
fileprivate func commonInit() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(didReceiveNotification(notification:)), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
|
||||
}
|
||||
|
||||
fileprivate func adjustCollectionViewBounds() {
|
||||
guard let collectionView = self.collectionView, let pagerView = self.pagerView else {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@
|
|||
// Created by Wenchao Ding on 17/12/2016.
|
||||
// Copyright © 2016 Wenchao Ding. All rights reserved.
|
||||
//
|
||||
// https://github.com/WenchaoD
|
||||
//
|
||||
// FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView. It is extremely helpful for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
|
|
@ -122,7 +126,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
|
|||
}
|
||||
|
||||
|
||||
/// The background view of the pager view
|
||||
/// The background view of the pager view.
|
||||
@IBInspectable
|
||||
open var backgroundView: UIView? {
|
||||
didSet {
|
||||
|
|
@ -136,7 +140,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
|
|||
}
|
||||
}
|
||||
|
||||
/// The transformer of the pager view
|
||||
/// The transformer of the pager view.
|
||||
open var transformer: FSPagerViewTransformer? {
|
||||
didSet {
|
||||
self.transformer?.pagerView = self
|
||||
|
|
@ -352,6 +356,11 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
|
|||
|
||||
// MARK: - Public functions
|
||||
|
||||
/// Register a class for use in creating new pager view cells.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - cellClass: The class of a cell that you want to use in the pager view.
|
||||
/// - identifier: The reuse identifier to associate with the specified class. This parameter must not be nil and must not be an empty string.
|
||||
@objc(registerClass:forCellWithReuseIdentifier:)
|
||||
open func register(_ cellClass: Swift.AnyClass?, forCellWithReuseIdentifier identifier: String) {
|
||||
guard let cellClass = cellClass, cellClass.isSubclass(of: FSPagerViewCell.self) else {
|
||||
|
|
@ -360,6 +369,12 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
|
|||
self.collectionView.register(cellClass, forCellWithReuseIdentifier: identifier)
|
||||
}
|
||||
|
||||
/// Returns a reusable cell object located by its identifier
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - identifier: The reuse identifier for the specified cell. This parameter must not be nil.
|
||||
/// - index: The index specifying the location of the cell.
|
||||
/// - Returns: A valid FSPagerViewCell object.
|
||||
@objc(dequeueReusableCellWithReuseIdentifier:atIndex:)
|
||||
open func dequeueReusableCell(withReuseIdentifier identifier: String, at index: Int) -> FSPagerViewCell {
|
||||
let indexPath = IndexPath(item: index, section: self.dequeingSection)
|
||||
|
|
@ -367,23 +382,39 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
|
|||
return cell
|
||||
}
|
||||
|
||||
/// Reloads all of the data for the collection view.
|
||||
@objc(reloadData)
|
||||
open func reloadData() {
|
||||
self.collectionView.reloadData()
|
||||
}
|
||||
|
||||
/// Selects the item at the specified index and optionally scrolls it into view.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - index: The index path of the item to select.
|
||||
/// - animated: Specify true to animate the change in the selection or false to make the change without animating it.
|
||||
@objc(selectItemAtIndex:animated:)
|
||||
open func selectItem(at index: Int, animated: Bool) {
|
||||
let indexPath = self.nearbyIndexPath(for: index)
|
||||
self.collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: .centeredHorizontally)
|
||||
}
|
||||
|
||||
/// Deselects the item at the specified index.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - index: The index of the item to deselect.
|
||||
/// - animated: Specify true to animate the change in the selection or false to make the change without animating it.
|
||||
@objc(deselectItemAtIndex:animated:)
|
||||
open func deselectItem(at index: Int, animated: Bool) {
|
||||
let indexPath = self.nearbyIndexPath(for: index)
|
||||
self.collectionView.deselectItem(at: indexPath, animated: animated)
|
||||
}
|
||||
|
||||
/// Scrolls the pager view contents until the specified item is visible.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - index: The index of the item to scroll into view.
|
||||
/// - animated: Specify true to animate the scrolling behavior or false to adjust the pager view’s visible content immediately.
|
||||
@objc(scrollToItemAtIndex:animated:)
|
||||
open func scrollToItem(at index: Int, animated: Bool) {
|
||||
guard index < self.numberOfItems else {
|
||||
|
|
|
|||
|
|
@ -9,11 +9,8 @@
|
|||
import UIKit
|
||||
|
||||
open class FSPagerViewCell: UICollectionViewCell {
|
||||
|
||||
fileprivate let kvoContext = UnsafeMutableRawPointer(bitPattern: 0)
|
||||
fileprivate let selectionColor = UIColor(white: 0.2, alpha: 0.2)
|
||||
|
||||
internal weak var _textLabel: UILabel?
|
||||
/// Returns the label used for the main textual content of the pager view cell.
|
||||
open var textLabel: UILabel? {
|
||||
if let _ = _textLabel {
|
||||
return _textLabel
|
||||
|
|
@ -33,8 +30,8 @@ open class FSPagerViewCell: UICollectionViewCell {
|
|||
_textLabel = textLabel
|
||||
return textLabel
|
||||
}
|
||||
|
||||
internal weak var _imageView: UIImageView?
|
||||
|
||||
/// Returns the image view of the pager view cell. Default is nil.
|
||||
open var imageView: UIImageView? {
|
||||
if let _ = _imageView {
|
||||
return _imageView
|
||||
|
|
@ -45,6 +42,12 @@ open class FSPagerViewCell: UICollectionViewCell {
|
|||
return imageView
|
||||
}
|
||||
|
||||
internal weak var _textLabel: UILabel?
|
||||
internal weak var _imageView: UIImageView?
|
||||
|
||||
fileprivate let kvoContext = UnsafeMutableRawPointer(bitPattern: 0)
|
||||
fileprivate let selectionColor = UIColor(white: 0.2, alpha: 0.2)
|
||||
|
||||
fileprivate weak var _selectedForegroundView: UIView?
|
||||
fileprivate var selectedForegroundView: UIView? {
|
||||
if let _ = _selectedForegroundView {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
# FSPagerView
|
||||
|
||||
| [<font size="4"><b>SWIFT</b></font>](https://github.com/WenchaoD/FSPagerView/blob/master/README.md) | <font size="4"><b>OBJECTIVE-C</b></font> |
|
||||
[](http://cocoadocs.org/docsets/FSPagerView)
|
||||
|
||||
|
||||
| [<font size="5"><b>SWIFT</b></font>](https://github.com/WenchaoD/FSPagerView/blob/master/README.md) | <font size="5"><b>OBJECTIVE-C</b></font> |
|
||||
|---|---|
|
||||
|
||||
**FSPagerView** is an elegant Screen Slide Library implemented primarily with ***UICollectionView***. It is extremely helpful for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
# FSPagerView
|
||||
|
||||
| <font size="4"><b>SWIFT</b></font> | [<font size="4"><b>OBJECTIVE-C</b></font>](https://github.com/WenchaoD/FSPagerView/blob/master/README-OBJECTIVE-C.md) |
|
||||
[](http://cocoadocs.org/docsets/FSPagerView)
|
||||
|
||||
| <font size="5"><b>SWIFT</b></font> | [<font size="5"><b>OBJECTIVE-C</b></font>](https://github.com/WenchaoD/FSPagerView/blob/master/README-OBJECTIVE-C.md) |
|
||||
|---|---|
|
||||
|
||||
**FSPagerView** is an elegant Screen Slide Library implemented primarily with ***UICollectionView***. It is extremely helpful for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.
|
||||
|
|
|
|||
Loading…
Reference in New Issue