Answers for "swift scrollview auto fit content height"

1

swift scrollview auto fit content height

CGRect contentRect = CGRectZero;

for (UIView *view in self.scrollView.subviews) {
    contentRect = CGRectUnion(contentRect, view.frame);
}
self.scrollView.contentSize = contentRect.size;
Posted by: Guest on March-15-2022
0

swift scrollview auto fit content height

let contentRect: CGRect = scrollView.subviews.reduce(into: .zero) { rect, view in
    rect = rect.union(view.frame)
}
scrollView.contentSize = contentRect.size
Posted by: Guest on March-15-2022

Code answers related to "swift scrollview auto fit content height"

Code answers related to "Swift"

Browse Popular Code Answers by Language