列表占位符
列表占位符
Facebook 新闻源风格动画
功能
列表占位符是一个 Swift 库,它允许您轻松地将 Facebook 风格的动画占位符添加到您的表格视图、集合视图或自定义视图中。
安装
推荐使用 CocoaPods
- 安装CocoaPods
- 将此仓库添加到您的
Podfile
target 'Example' do
# IMPORTANT: Make sure use_frameworks! is included at the top of the file
use_frameworks!
platform :ios, '8.0'
pod 'ListPlaceholder'
end
- 运行
pod install
- 打开 CocoaPods 创建的
.xcworkspace
- 完成!
手动安装
只需从这里下载 ListLoader.swift
文件到您的项目,确保您指向您的项目目标
用法
import ListPlaceholder
UITableView 使用
//to show the loader
tableView.reloadData()
tableView.showLoader()
//to hide the loader
tableView.hideLoader()
UICollectionView 使用
//to show the loader
collectionView.reloadData()
collectionView.layoutIfNeeded()
collectionView.showLoader()
//to hide the loader
collectionView.hideLoader()
UIView 使用
//to show the loader
customView.showLoader()
//to hide the loader
customView.hideLoader()
现在占位符也支持 Objective-C 语言
@import ListPlaceholder;
//to show the loader
[_customView showLoader];
//to hide the loader
[_customView hideLoader];
示例项目
查看此处的示例项目
- 下载它
- 在 Xcode 中打开
Example.xcworkspace
- 享受吧!
作者
Moayad Al kouz, [email protected]
许可协议
ListPlaceholder可在MIT许可下使用。更多信息请参阅LICENSE文件。