Skip to content

Commit

Permalink
Merge pull request #13 from linhay/12-uiscrollview设置contentinset后空布局位…
Browse files Browse the repository at this point in the history
…置偏移不居中

chore: 修复 contentInset 引起的偏移
  • Loading branch information
linhay authored Apr 5, 2022
2 parents be9a449 + e8d4412 commit cead9ca
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion EmptyPage.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'EmptyPage'
s.version = '4.0.9'
s.version = '4.0.10'
s.summary = 'iOS - 轻量级空白页占位图框架...'

s.homepage = 'https://github.com/linhay/EmptyPage'
Expand Down
1 change: 1 addition & 0 deletions Example/EmptyPage/tests/TestStateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TestStateViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
sectionView.contentInset = .init(top: 40, left:100, bottom: 0, right: 0)
sectionView.ex.set(emptyView: TemplateSet.image_animate().mix(), for: .loading)
sectionView.ex.set(emptyView: TemplateSet.image_normal().mix(), for: .normal)
sectionView.ex.set(emptyView: TemplateSet.standard1(tapEvent: nil).mix(), for: .noNetwork)
Expand Down
16 changes: 8 additions & 8 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PODS:
- EmptyPage (4.0.7):
- EmptyPage/core (= 4.0.7)
- EmptyPage/managers (= 4.0.7)
- EmptyPage/templates (= 4.0.7)
- EmptyPage/core (4.0.7)
- EmptyPage/managers (4.0.7):
- EmptyPage (4.0.10):
- EmptyPage/core (= 4.0.10)
- EmptyPage/managers (= 4.0.10)
- EmptyPage/templates (= 4.0.10)
- EmptyPage/core (4.0.10)
- EmptyPage/managers (4.0.10):
- EmptyPage/core
- EmptyPage/templates (4.0.7):
- EmptyPage/templates (4.0.10):
- EmptyPage/core
- MJRefresh (3.7.5)
- ReachabilitySwift (5.0.0)
Expand All @@ -32,7 +32,7 @@ EXTERNAL SOURCES:
:path: "../EmptyPage.podspec"

SPEC CHECKSUMS:
EmptyPage: 53c1bfb5092b32d2d4ab97c7f1ab738825464b22
EmptyPage: 5c0b8683f3e4e83084173aa122807f0b1211b4a4
MJRefresh: fdf5e979eb406a0341468932d1dfc8b7f9fce961
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
Expand Down
6 changes: 5 additions & 1 deletion Sources/Core/managers/EmptyPageViewManagerProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ public extension EmptyPageViewManagerProtocol {
guard let delegate = target, let view = emptyView, view.superview == delegate else {
return
}
view.frame = CGRect(origin: .zero, size: delegate.frame.size)
if let delegate = delegate as? UIScrollView {
view.frame = CGRect(origin: .init(x: -delegate.contentInset.left, y: -delegate.contentInset.top), size: delegate.frame.size)
} else {
view.frame = CGRect(origin: .zero, size: delegate.frame.size)
}
}

func ep_reload(completion: ((_ isEmpty: Bool) -> Void)? = nil) {
Expand Down

0 comments on commit cead9ca

Please sign in to comment.