iPhone - UIScrollView inside UIView not scrolling

前端 未结 3 1236
清酒与你
清酒与你 2021-02-07 21:11

I have a UIView which contains lot of labels, buttons, textviews. But there is a certain part of that UIView that I want to make scrollable.Here is how

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-07 21:42

    You better should let the compiler figure out the height, instead of setting it yourself.

    CGFloat height = 0;
    for (UIView *v in _scrollView.subviews) {
        height += v.frame.size.height;
    }
    
    _scrollView.contentSize = CGSizeMake(self.view.frame.size.width, height);
    

提交回复
热议问题