Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display fix in debug view hierarchy #41

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions CRRefresh.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
Pod::Spec.new do |s|

s.name = "CRRefresh"
s.version = "1.1.3"
s.version = "1.1.4"
s.summary = "An easy way to use pull-to-refresh"
s.homepage = "https://github.com/CRAnimation/CRRefresh"
s.license = 'MIT'
s.author = { "W_C__L" => "wangchonglei93@icloud.com" }
s.platform = :ios, "8.0"
s.swift_version = '4.2'
s.platform = :ios, "9.0"
s.swift_version = '5.0'
s.source = { :git => "https://github.com/CRAnimation/CRRefresh.git", :tag => s.version.to_s }
s.source_files = ['CRRefresh/CRRefresh/*.{swift}','CRRefresh/CRRefresh/Animators/**/*.{swift}']
s.resources = 'CRRefresh/CRRefresh/Animators/**/*.{bundle}'
s.source_files = ['Sources/CRRefresh/*.{swift}','Sources/CRRefresh/Animators/**/*.{swift}']
s.resources = 'Sources/CRRefresh/Animators/**/*.{bundle}'
s.frameworks = "UIKit"
s.requires_arc = true

Expand Down
24 changes: 0 additions & 24 deletions CRRefresh/Info.plist

This file was deleted.

2 changes: 1 addition & 1 deletion Demo/BaseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func getSystemVersion() -> Double {
}

public extension UIColor {
public convenience init(rgb: (r: CGFloat, g: CGFloat, b: CGFloat)) {
convenience init(rgb: (r: CGFloat, g: CGFloat, b: CGFloat)) {
self.init(red: rgb.r/255, green: rgb.g/255, blue: rgb.b/255, alpha: 1.0)
}
}

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Demo/RefreshController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ class RefreshController: BaseViewController {
print("开始加载")
DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
self?.count += 10
self?.tableView.cr.noticeNoMoreData()
self?.tableView.cr.endLoadingMore()
self?.tableView.reloadData()
})
}

tableView.isPagingEnabled = true

}

//MARK: Override
Expand Down
23 changes: 23 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "CRRefresh",
platforms: [.iOS(.v9)],
products: [
.library(
name: "CRRefresh",
targets: ["CRRefresh"]),
],
targets: [
.target(
name: "CRRefresh",
resources: [
.copy("Assets/"),
// .process("Resources/config.json"),
// .copy("Resources/HTML")
]),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class FastCheckLayer: CALayer {
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override init(layer: Any) {
color = .init(rgb: (214, 214, 214))
lineWidth = 1
super.init(layer: layer)
}

//MARK: Privater Methods
private func drawCheck() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ class FastCircleLayer: CALayer {
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override init(layer: Any) {
color = .init(rgb: (214, 214, 214))
pointColor = .init(rgb: (165, 165, 165))
lineWidth = 1
super.init(layer: layer)
}

//MARK: Public Methods
func startAnimation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ class FastLayer: CALayer {

let lineWidth: CGFloat

//MARK: Public Methods


//MARK: Override


//MARK: Initial Methods
init(frame: CGRect, color: UIColor = .init(rgb: (214, 214, 214)), arrowColor: UIColor = .init(rgb: (165, 165, 165)), lineWidth: CGFloat = 1) {
self.color = color
Expand All @@ -58,6 +52,13 @@ class FastLayer: CALayer {
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override init(layer: Any) {
color = .init(rgb: (214, 214, 214))
arrowColor = .init(rgb: (165, 165, 165))
lineWidth = 1
super.init(layer: layer)
}

//MARK: Privater Methods
private func initCircle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ open class NormalFooterAnimator: UIView, CRRefreshProtocol {

open func refresh(view: CRRefreshComponent, stateDidChange state: CRRefreshState) {
switch state {
case .idle:
titleLabel.text = loadingMoreDescription
case .refreshing :
titleLabel.text = loadingDescription
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ open class CRRefreshFooterView: CRRefreshComponent {
open override func sizeChange(change: [NSKeyValueChangeKey : Any]?) {
guard let scrollView = scrollView else { return }
super.sizeChange(change: change)
let targetY = scrollView.contentSize.height + scrollViewInsets.bottom
let targetY = scrollView.contentSize.height
if self.frame.origin.y != targetY {
var rect = self.frame
rect.origin.y = targetY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ open class CRRefreshHeaderView: CRRefreshComponent {
insets.top += animator.execute
insetTDelta = -animator.execute
holdInsetTDelta = -(animator.execute - animator.hold)
UIView.animate(withDuration: CRRefreshComponent.animationDuration, animations: {
var point = scrollView.contentOffset;
point.y = -insets.top
UIView.animate(withDuration: CRRefreshComponent.animationDuration, animations: {

scrollView.contentOffset.y = self.previousOffsetY
scrollView.contentInset = insets
scrollView.contentOffset.y = -insets.top
// scrollView.contentOffset.y = -insets.top
scrollView.setContentOffset(point, animated: false);


}) { (finished) in
DispatchQueue.main.async {
self.handler?()
Expand Down