Skip to content
This repository was archived by the owner on Jan 15, 2026. It is now read-only.

Commit 0f64c74

Browse files
Merge pull request #64 from iZettle/adjustContentOffset-fix
Fixed a bug in `UIScrollView.adjustContentOffset` for scrollviews wit…
2 parents abf9146 + dbc5df7 commit 0f64c74

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Added `UITextField` and `UIScrollView` `install()` delegate helpers.
55
- Added remaining methods to `ScrollViewDelegete`.
66
- Added `GestureRecognizerDelegate`.
7+
- Fixed a bug in `UIScrollView.adjustContentOffset` for scrollviews with a non-zero `frame.origin.y`.
78

89
## 1.3.3
910
- Bugfix: Remove hardcoded value used for determing smallest resizable image size causing not smooth borders of rounded images

Form/UIScrollView+Keyboard.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ private extension UIScrollView {
164164
func adjustContentOffset(_ adjustInsets: (UIView) -> UIEdgeInsets) {
165165
guard let firstResponder = firstResponder as? UIView else { return }
166166

167-
var bounds = frame // Can't use a scroll views bounds directly.
168-
bounds.origin = .zero
169-
let viewRect = UIEdgeInsetsInsetRect(bounds, contentInset)
167+
let viewRect = UIEdgeInsetsInsetRect(frame, contentInset)
170168
let firstBounds = UIEdgeInsetsInsetRect(firstResponder.bounds, adjustInsets(firstResponder))
171169
let firstFrame = convert(firstBounds, from: firstResponder)
172170

0 commit comments

Comments
 (0)