使用 UIViewController 数组中的presentModalViewController

发布于 2024-11-18 03:14:47 字数 768 浏览 2 评论 0原文

在我的应用程序中,有一个包含按钮的“主”UIViewController;一旦单击其中一个按钮,它就会打开另一个 UIViewController(我们称之为 dataUIViewController) - 当单击该 dataUIViewController 时,它会打开另一个 dataUIViewController 等等,直到到达最后一个,然后所有 dataUIViewController 都被释放,我们回到 mainUIViewController 。所有 dataUIViewController 均使用presentModalViewController 进行调用。

我以一种方式实现它,每个 dataUIViewController 都是在前一个 dataUIViewController 中创建的(因此第二个是在第一个 dataUIViewController 中创建的,第三个是在第二个 dataUIViewController 中创建的,等等......);我有一个释放方法,其中 dataUIViewControllers 被递归释放。当然,如果机器过载,我会收到内存警告...

我现在尝试以另一种方式构建它 - 使用位于 mainUIViewController 中的 NSMutableArray,该 NSMutableArray 依次保存和调用每个 dataUIViewController 并在完成后释放它。

问题是,presentModalViewController 不适用于我从 NSMutableArray 中取出的 dataUIViewController - 它根本无法加载;相反,它会转到下一个代码行。

有人吗?

In my app there is a "main" UIViewController that holds buttons; once clicking on one of the buttons it opens another UIViewController (lets call it dataUIViewController) - when clicking on that dataUIViewController it open another dataUIViewController and so on until it reaches the last one and then all the dataUIViewControllers are released and we go back to the mainUIViewController. all the dataUIViewControllers are called using presentModalViewController.

I implemented it in a way where each dataUIViewController is created within the previous dataUIViewController (so the 2nd one is created within the 1st one and the 3rd is created within the 2nd etc...); I have a release method where the dataUIViewControllers are released recursively. Of course, I get memory warnings in case the machine is overloaded...

I'm now trying to build it in another way - using an NSMutableArray located in the mainUIViewController that holds and calles each dataUIViewController in its turn and releases it when done.

The problem is that presentModalViewController doesn't work on the dataUIViewController that I'm taking out of the NSMutableArray - it simply doesn't load; instead it goes to the next code line.

Anyone?

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

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

发布评论

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

评论(2

我不咬妳我踢妳 2024-11-25 03:14:47

我看不出您的视图控制器不加载的原因。
视图控制器似乎没有正确设置。
你是如何初始化它们的?

I see no reason why your view controllers don't load.
It seems that the view controllers are not properly set up.
How did you initialize them ?

鲜肉鲜肉永远不皱 2024-11-25 03:14:47

我将它改造为基于 UINavigationController 并且它工作得更好。我确实更喜欢 modalViewController 的可见性,但是,嘿,你能说什么,你赢得了一些 - 你失去了一些......

I transformed it to be based on UINavigationController and it works much better. I do prefer the visibility of the modalViewController but, hey, what can you say, you win some - you lose some...

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