Skip to content

Commit 8e16d64

Browse files
committed
Merge branch 'master' of github.com:indragiek/InAppViewDebugger
2 parents 6c1120e + d66c4e0 commit 8e16d64

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

InAppViewDebugger/InAppViewDebugger.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import UIKit
8080
}
8181
let debuggerViewController = ViewDebuggerViewController(snapshot: snapshot, configuration: configuration ?? Configuration())
8282
let navigationController = UINavigationController(rootViewController: debuggerViewController)
83-
topViewController(rootViewController: rootViewController)?.present(navigationController, animated: true, completion: nil)
83+
topViewController(rootViewController: rootViewController)?.present(navigationController, animated: true, completion: completion)
8484
}
8585

8686
@available(*, unavailable)

InAppViewDebugger/ViewElement.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import UIKit
2323
}
2424

2525
public var frame: CGRect {
26-
return view?.frame ?? .zero
26+
let offset = contentOffsetForView(view)
27+
return view?.frame.offsetBy(dx: offset.x, dy: offset.y) ?? .zero
2728
}
2829

2930
public var isHidden: Bool {
@@ -155,3 +156,9 @@ fileprivate func snapshotView(_ view: UIView) -> CGImage? {
155156
}
156157
return image
157158
}
159+
160+
fileprivate func contentOffsetForView(_ view: UIView?) -> CGPoint {
161+
guard let scrollView = view?.superview as? UIScrollView else { return .zero }
162+
let contentOffset = scrollView.contentOffset
163+
return CGPoint(x: -contentOffset.x, y: -contentOffset.y)
164+
}

0 commit comments

Comments
 (0)