开发者

Adding view to UIScrollView and toggling scrolling/interacting

开发者 https://www.devze.com 2022-12-23 12:55 出处:网络
I have a UIScrollView in my project. I have a view controller I would like to add as a child of the UIScrollview. Would I just do that like this:

I have a UIScrollView in my project. I have a view controller I would like to add as a child of the UIScrollview. Would I just do that like this:

[scrollView addSubview:theViewController.view];

or is there a better way? (theView is a view, not the TV show)

Furthermore, I would like to be able to use a UIButton in开发者_如何学编程 scrollView's parent view controller to toggle whether or not the user is scrolling with scrollView and NOT interacting with theView or NOT scrolling with scrollview and interacting with theView. Should I just have that set the property:

scrollView.userInteractionEnabled = NO;

or would that disable interaction with theView because it's a child?

Thanks for your help!


  1. This is the proper way.
  2. On the scrollView, setScrollEnabled: to turn off scrolling.
0

精彩评论

暂无评论...
验证码 换一张
取 消