Swift Scrollview Auto Fit Content Height

[Solved] Swift Scrollview Auto Fit Content Height | Swift - Code Explorer | yomemimo.com
Question : swift scrollview auto fit content height

Answered by : thankful-turkey-sm2803o1z6ab

CGRect contentRect = CGRectZero;
for (UIView *view in self.scrollView.subviews) { contentRect = CGRectUnion(contentRect, view.frame);
}
self.scrollView.contentSize = contentRect.size;

Source : https://stackoverflow.com/questions/2944294/how-do-i-auto-size-a-uiscrollview-to-fit-its-content | Last Update : Tue, 22 Mar 22

Question : swift scrollview auto fit content height

Answered by : thankful-turkey-sm2803o1z6ab

let contentRect: CGRect = scrollView.subviews.reduce(into: .zero) { rect, view in rect = rect.union(view.frame)
}
scrollView.contentSize = contentRect.size

Source : https://stackoverflow.com/questions/2944294/how-do-i-auto-size-a-uiscrollview-to-fit-its-content | Last Update : Tue, 22 Mar 22

Answers related to swift scrollview auto fit content height

Code Explorer Popular Question For Swift