gpt4 book ai didi

IOS - 如何更新presentModalViewController中的 View ?

转载 作者:行者123 更新时间:2023-11-29 04:38:04 24 4
gpt4 key购买 nike

我是 IOS 开发新手。在我的应用程序中,我想替换正在呈现的 View 模型。我通过调用来显示我的初始 View :presentModalViewController

当我替换 View 时,我不希望整个动画运行。我只是想更改要更新的presentModalViewController底层 View 。

当我设置时:

self.presentModalViewController.view = myCustomViewController.view

它第一次运行得很好,并且确实取代了 View 但是,当我尝试再次执行此操作并在应用程序实时中的其他位置替换 View 内容时,presentModalViewController 不会更新。

如何更新presentModalViewController中的 View

最佳答案

这实际上取决于您想要实现的目标。

1 - 新 View 是否具有全新的行为?也许使用新的 UIViewController 可能是一个解决方案。

2 - 如果您对第一个问题的回答,那么 XIB 内的辅助 UIView 就可以解决问题。只要您可以使用 IBOUtlet 访问它即可。


编辑1:

I show my initial view by calling: presentModalViewController

如果你正在展示它(那就是你所在的位置),你的行动方针应该在它的内部,而不是外部。例如:

self.view = mySecondaryView;

关于IOS - 如何更新presentModalViewController中的 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10801599/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com