Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit 4210eca

Browse files
Rename Protocol function
1 parent 04a65ba commit 4210eca

17 files changed

Lines changed: 86 additions & 59 deletions

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## v0.8.2
2+
3+
### Add
4+
5+
- Add `heightForHeader` and `heightForFooter` in Protocols
6+
- Do not need to set frame height when set up header&footer&left&right
7+
8+
### Updated
9+
10+
- Rename `didBeginEndRefershingAnimation` to `didBeginHideRefershingAnimation`
11+
- Rename `didCompleteEndRefershingAnimation` to `didCompleteHideRefershingAnimation`
12+
- Rename `durationWhenEndRefreshing` to `durationOfHideAnimation`
13+
14+
## Fixd
15+
16+
- Fix footer frame issue

Demo/Demo/ConfigHeaderFooterController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ConfigDefaultHeaderFooterController: UITableViewController {
1414
override func viewDidLoad() {
1515
super.viewDidLoad()
1616
self.tableView.tableFooterView = UIView(frame: CGRect.zero)
17-
17+
1818
//Header
1919
let header = DefaultRefreshHeader.header()
2020
header.setText("Pull to refresh", mode: .pullToRefresh)
@@ -43,7 +43,7 @@ class ConfigDefaultHeaderFooterController: UITableViewController {
4343
delay(1.5, closure: {
4444
self.models.append(random100())
4545
self.tableView.reloadData()
46-
if self.models.count > 12{
46+
if self.models.count > 18{
4747
self.tableView.switchRefreshFooter(to: .removed)
4848
}else{
4949
self.tableView.switchRefreshFooter(to: .normal)

Demo/Demo/DefaultCollectionViewController.swift

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,23 @@ import PullToRefreshKit
1212

1313
class DefaultCollectionViewController:UIViewController,UICollectionViewDataSource{
1414
var collectionView:UICollectionView!
15+
var count = 9
1516
override func viewDidLoad() {
1617
self.view.backgroundColor = UIColor.white
1718
self.setUpCollectionView()
18-
self.collectionView.configRefreshHeader(with: DefaultRefreshHeader.header()) {
19+
self.collectionView.configRefreshHeader(with: DefaultRefreshHeader.header()) { [weak self] in
1920
delay(1.0, closure: {
20-
self.collectionView.switchRefreshHeader(to: .normal(.success, 0.5));
21+
self?.collectionView.switchRefreshHeader(to: .normal(.success, 0.5));
2122
});
2223
}
23-
self.collectionView.configRefreshFooter(with: DefaultRefreshFooter.footer()) {
24+
self.collectionView.configRefreshFooter(with: DefaultRefreshFooter.footer()) { [weak self] in
2425
delay(1.0, closure: {
25-
self.collectionView.switchRefreshFooter(to: .normal)
26+
guard let sf = self else{
27+
return
28+
}
29+
sf.count = sf.count + 3
30+
sf.collectionView.reloadData()
31+
sf.collectionView.switchRefreshFooter(to: .normal)
2632
});
2733
};
2834

@@ -31,15 +37,16 @@ class DefaultCollectionViewController:UIViewController,UICollectionViewDataSourc
3137
let flowLayout = UICollectionViewFlowLayout()
3238
flowLayout.scrollDirection = UICollectionViewScrollDirection.vertical
3339
flowLayout.itemSize = CGSize(width: 100, height: 100)
34-
self.collectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: flowLayout)
40+
let frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: 300)
41+
self.collectionView = UICollectionView(frame:frame, collectionViewLayout: flowLayout)
3542
self.collectionView?.backgroundColor = UIColor.white
3643
self.collectionView?.dataSource = self
3744
self.view.addSubview(self.collectionView!)
3845

3946
self.collectionView?.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
4047
}
4148
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
42-
return 21
49+
return self.count
4350
}
4451
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
4552
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)

Demo/Demo/DefaultTableViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
2121
}
2222

2323
class DefaultTableViewController:UITableViewController{
24-
let originalModes = [1,2,3,4,5,6,7,8,9,10]
25-
var models = [1,2,3,4,5,6,7,8,9,10]
24+
let originalModes = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
25+
var models = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
2626
override func viewDidLoad() {
2727
super.viewDidLoad()
2828
self.tableView.tableFooterView = UIView(frame: CGRect.zero)
@@ -38,7 +38,7 @@ class DefaultTableViewController:UITableViewController{
3838
delay(1.5, closure: {
3939
self.models.append(random100())
4040
self.tableView.reloadData()
41-
if self.models.count < 12 {
41+
if self.models.count < 18 {
4242
self.tableView.switchRefreshFooter(to: .normal)
4343
}else{
4444
self.tableView.switchRefreshFooter(to: .noMoreData)

Demo/Demo/DianpingRefreshHeader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ class DianpingRefreshHeader:UIView,RefreshableHeader{
4949
imageView.startAnimating()
5050
}
5151
//刷新结束,将要隐藏header
52-
func didBeginEndRefershingAnimation(_ result:RefreshResult){}
52+
func didBeginHideAnimation(_ result:RefreshResult){}
5353
//刷新结束,完全隐藏header
54-
func didCompleteEndRefershingAnimation(_ result:RefreshResult){
54+
func didCompleteHideAnimation(_ result:RefreshResult){
5555
imageView.animationImages = nil
5656
imageView.stopAnimating()
5757
imageView.isHidden = true

Demo/Demo/QQVideoRefreshHeader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class QQVideoRefreshHeader:UIView,RefreshableHeader{
4848
imageView.startAnimating()
4949
}
5050
//刷新结束,将要隐藏header
51-
func didBeginEndRefershingAnimation(_ result:RefreshResult){}
51+
func didBeginHideAnimation(_ result:RefreshResult){}
5252
//刷新结束,完全隐藏header
53-
func didCompleteEndRefershingAnimation(_ result:RefreshResult){
53+
func didCompleteHideAnimation(_ result:RefreshResult){
5454
imageView.animationImages = nil
5555
imageView.stopAnimating()
5656
imageView.image = UIImage(named: "loading15")

Demo/Demo/TaoBaoRefreshHeader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ class TaoBaoRefreshHeader:UIView,RefreshableHeader{
111111
textLabel.text = "刷新中..."
112112
}
113113

114-
func didBeginEndRefershingAnimation(_ result:RefreshResult){
114+
func didBeginHideAnimation(_ result:RefreshResult){
115115
transitionWithOutAnimation {
116116
self.circleLayer.strokeEnd = 0.05
117117
};
118118
self.circleLayer.removeAllAnimations()
119119
}
120120

121-
func didCompleteEndRefershingAnimation(_ result:RefreshResult){
121+
func didCompleteHideAnimation(_ result:RefreshResult){
122122
transitionWithOutAnimation {
123123
self.circleLayer.strokeEnd = 0.05
124124
};

Demo/Demo/YahooWeatherRefreshHeader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ class YahooWeatherRefreshHeader: UIView,RefreshableHeader{
7979
startTransitionAnimation()
8080
}
8181
//刷新结束,将要隐藏header
82-
func didBeginEndRefershingAnimation(_ result:RefreshResult){
82+
func didBeginHideAnimation(_ result:RefreshResult){
8383

8484
}
8585
//刷新结束,完全隐藏header
86-
func didCompleteEndRefershingAnimation(_ result:RefreshResult){
86+
func didCompleteHideAnimation(_ result:RefreshResult){
8787
imageView.stopAnimating()
8888
imageView.animationImages = nil
8989
imageView.image = UIImage(named: "sun_000000")

Demo/Demo/YoukuRefreshHeader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ class YoukuRefreshHeader:UIView,RefreshableHeader{
7676
self.rotatingImageView.layer.add(rotateAnimation, forKey: "rotate")
7777
}
7878
//刷新结束,将要隐藏header
79-
func didBeginEndRefershingAnimation(_ result:RefreshResult){
79+
func didBeginHideAnimation(_ result:RefreshResult){
8080
self.rotatingImageView.isHidden = true
8181
self.iconImageView.isHidden = false
8282
self.iconImageView.layer.removeAllAnimations()
8383
self.iconImageView.layer.transform = CATransform3DIdentity
8484
self.iconImageView.image = UIImage(named: "youku_down")
8585
}
8686
//刷新结束,完全隐藏header
87-
func didCompleteEndRefershingAnimation(_ result:RefreshResult){
87+
func didCompleteHideAnimation(_ result:RefreshResult){
8888
}
8989
}

PullToRefreshKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'PullToRefreshKit'
11-
s.version = '0.8.0'
11+
s.version = '0.8.2'
1212
s.summary = 'A refresh library written with pure Swift 4'
1313
s.description = <<-DESC
1414
This is a pull to refresh library written by pure Swift 4. Using it you can add pull to refresh,pull to load more,pull left/right to view details within one line. Besides,it is quite easy to write a custom refresh view when using this lib.

0 commit comments

Comments
 (0)