将视图添加到 UIScrollView 并切换滚动/交互
我的项目中有一个 UIScrollView 。我有一个视图控制器,我想添加为 UIScrollview 的子视图。我会这样做吗:
[scrollView addSubview:theViewController.view];
还是有更好的方法? (theView是一个视图,而不是电视节目)
此外,我希望能够在scrollView的父视图控制器中使用UIButton来切换用户是否使用scrollView滚动而不与theView交互或不使用scrollview滚动以及与视图交互。我应该只设置属性:
scrollView.userInteractionEnabled = NO;
还是会禁用与 theView 的交互,因为它是一个孩子?
感谢您的帮助!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
setScrollEnabled:
关闭滚动。setScrollEnabled:
to turn off scrolling.