728x90
스크롤뷰의 높이를 컨텐츠에 맞게 설정하는 방법!
scrollview의 subview의 frame을 'CGRectUnion' 함수를 이용하여 설정할 수 있다.
CGRect contentRect = CGRectZero;
for (UIView *view in self.scroll.subviews) {
for (UIView * content in view.subviews) {
contentRect = CGRectUnion(contentRect, content.frame);
}
}
self.scroll.contentSize = contentRect.size;
참고 : https://stackoverflow.com/questions/2944294/how-do-i-auto-size-a-uiscrollview-to-fit-its-content
728x90
'iOS > iOS' 카테고리의 다른 글
UISegmentedControl (0) | 2022.10.19 |
---|---|
UITabBar (0) | 2022.10.19 |
특정 viewcontroller로 pop (0) | 2022.10.13 |
Animation (0) | 2022.10.11 |
지도앱 URL Scheme (0) | 2022.10.05 |
댓글