Monotouch UIScrollView 和 ModalView 问题

发布于 2024-10-15 13:33:55 字数 440 浏览 5 评论 0原文

在我的程序中,我在后台有一个主窗口,上面有一个较小的 UIScrollView。我在滚动视图的每一页上都有按钮,我想调出一个可以关闭的模式视图。它对于第一页效果很好,但是,当我单击滚动视图第二页上的按钮时,弹出的模式视图位于第一页而不是第二页的顶部,并且第二页完全空白。当我关闭模态视图时,第一页已被第二页替换,第二页仍为空白...我使用的代码是:

MVC = new NewsModalViewController(this);

MVC.ModalTransitionStyle = UIModalTransitionStyle.CoverVertical;

MVC.ModalPresentationStyle = UIModalPresentationStyle.CurrentContext;

我一直在尝试使用框架,但没有运气...

有什么见解吗?

干杯

In my program I have the main window in the background which has a smaller, UIScrollView on it. I have buttons on each page of the scroll view which I want to bring up a modal view that can be dissmissed. It works fine for the first page, however, when I click the button on the second page of the scroll view the modal view that is brought up is on top of the first page instead of the second and the second page is completely blank. When I close the modal view, the first page has been replaced with the second page and the second page is still left blank... The code I am using is:

MVC = new NewsModalViewController(this);

MVC.ModalTransitionStyle = UIModalTransitionStyle.CoverVertical;

MVC.ModalPresentationStyle = UIModalPresentationStyle.CurrentContext;

I've been trying to play around with the frames but having no luck...

Any insights?

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七颜 2024-10-22 13:33:55

我将重写子页面以触发父视图侦听的事件。然后,从父视图显示模式(您实际上可以在子视图中创建模式并将其传递给事件)。这消除了将模态应用于错误上下文的任何问题。

可能还有另一种解释,但这是我在几个应用程序上实现的方法,并且对我很有帮助。看来模态框最好仅从堆栈中的最高级别视图显示。

I would rewrite the subpages to fire an event that the parent view listens to. Then, display the modal from the parent view (you can actually create the modal in the child view and pass it up on the event). This eliminates any problems with the modal being applied to the wrong context.

There may be another explanation, but this is the method I've implemented on a couple applications and has served me well. It appears that modals are best displayed only from the highest level view in the stack.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文