How can I nest a UIScrollView inside a UIScrollView, so that the user can scroll the inner UIScrollView?

前端 未结 4 1832
孤街浪徒
孤街浪徒 2021-01-05 05:42

I haven\'t tried that yet, but I assume that I would have to disable scrolling of the parent scroll view as soon as I know that the user will want to scroll in the child scr

4条回答
  •  一向
    一向 (楼主)
    2021-01-05 06:08

    I had this same problem till I set dynamically enough height to the contentSize of the inner ScrollView, using:

    [scrollView setContentSize:CGSizeMake(scrollView.frame.size.width,600)];
    

    Obviously this is just a hardcoded example, you should set the height needed to display the whole content of the view, and maybe no scroll is needed in the end.

    It seems that setting the height of the scrollView using the IBuilder is not enough, so no scroll was needed and that's why I was thinking that the sweep event wasn't reaching the inner scroll.

    Hope this helps!

提交回复
热议问题