Правки анимации

This commit is contained in:
Merkulov Ilya 2016-04-18 13:47:49 +03:00
parent 2e700cf269
commit ab9f81efba
3 changed files with 10 additions and 16 deletions

View File

@ -45,8 +45,8 @@ public class RMRPullToRefresh: NSObject {
сontroller?.configureView(view, state: state, result: result)
}
public func configureView(view :RMRPullToRefreshView) {
сontroller?.configureView(view, result: .Success)
public func configureView(view :RMRPullToRefreshView, result:RMRPullToRefreshResultType) {
сontroller?.configureView(view, result: result)
}
public func setupDefaultSettings() {

View File

@ -208,7 +208,9 @@ public class RMRPullToRefreshController: NSObject {
}
@objc private func stopAllAnimations() {
stopped = true
if shouldHideWhenStopLoading() {
stopped = true
}
containerView.stopAllAnimations(shouldHideWhenStopLoading())
}
@ -224,7 +226,7 @@ public class RMRPullToRefreshController: NSObject {
private func scrollViewDidChangePanState(scrollView: UIScrollView, panState: UIGestureRecognizerState) {
if panState == .Ended || panState == .Cancelled || panState == .Failed {
if state == .Loading || !stopped {
if state == .Loading || (shouldHideWhenStopLoading() && !stopped) {
return
}
@ -248,18 +250,6 @@ public class RMRPullToRefreshController: NSObject {
} else {
state = .Stopped
updateContainerView(state)
if !shouldHideWhenStopLoading() {
var inset = scrollView.contentInset
if position == .Top && inset.top != originalTopInset {
inset.top = originalTopInset
setContentInset(inset, animated: true)
self.performSelector(#selector(forceStopAllAnimations), withObject: nil, afterDelay: 0.2)
} else if position == .Bottom && inset.top != originalBottomInset {
inset.bottom = originalBottomInset
setContentInset(inset, animated: true)
self.performSelector(#selector(forceStopAllAnimations), withObject: nil, afterDelay: 0.2)
}
}
}
}
}

View File

@ -64,6 +64,10 @@ class ViewController: UIViewController, UITableViewDataSource, UITableViewDelega
} else if exampleType == .RedmadrobotTop || exampleType == .RedmadrobotBottom {
redmadrobot()
}
pullToRefresh?.setHideDelay(5.0, result: .Success)
pullToRefresh?.hideWhenError = false
}
// MARK: - Build example values