带有分页和新视图控制器的 UIScrollView
我目前有一个应用程序,它有一个 UIScrollView,以分页作为主要 ViewController。然而,目前,我正在尝试为新的 ViewController 制作动画,但每当我使用 PresentModalViewController 或使用 UIView 的动画时,我仍然可以在原始视图上向左和向右滚动。
我成功地通过将其添加到窗口来阻止它滚动:
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window addSubview:NEWVIEW.view];
[window makeKeyAndVisible];
但是,在使用此代码后,我不确定如何返回到原始的滚动视图。
感谢您提供的任何帮助。
I currently have an app that has a UIScrollView with paging as the primary ViewController. However, currently, I am trying to animate to a new ViewController, but whenever I use presentModalViewController or an animation using UIView, I am still able to scroll, left and right on the original view.
I was successfully able to keep it from scrolling by adding it to the window:
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window addSubview:NEWVIEW.view];
[window makeKeyAndVisible];
However, after using this code, I was uncertain of how to return to the original scrollView.
Thank You for any help you can provide.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:
我通过将所有视图控制器放入一个 xib 文件中解决了这个问题。我将所有设置为 IBOutlets,然后 modalViewController 工作得很好。
Solution:
I fixed this problem by putting all of my viewcontrollers into one xib file. I set then all up as IBOutlets and then modalViewController worked just fine.