1

我意识到我可以分层呈现模态视图。使用下面列出的选择器呈现多个模式视图时

presentModalViewController:动画:

(结构的层次应该是A->B->C->D->F........)

假设我创建了很多模态视图,每个视图都有相当多的内容。我怎么知道我是否达到了内存的极限?如果应用程序处于“挂起”状态并收到内存不足警告。

如果用户重新启动应用程序会发生什么?

4

2 回答 2

0

处理一个模态视图控制器并放置另一个模态视图控制器的方法是仅对最后一个进行动画处理:

[self dismissModalViewControllerAnimated:NO];
[self presentModalViewController:controllerB
   animated:YES];
于 2012-10-12T01:03:18.440 回答
0

There's no limit of modal views (I'm not aware of it) - just memory. And you can't check if you have enough memory or not. System will tell you when you reach your limit with memory warning.

What do you mean with relaunch? Suspend & resume? If yes, nothing. Kill & fresh start? No modal views unless you present them again.

The best way to accomplish this task is to release all objects that can be recreated in A when you do display B. Release in B when you do display in C and so on. But it depends on what do you want to display in them (in other words, amount of memory used by each view controller).

于 2012-10-11T20:30:04.693 回答