简体   繁体   English

在不重置第一视图的情况下切换视图

[英]Switching views without first view being reset

I'm making a role-playing game, and I want to have a Map View and a Battle Screen. 我正在做一个角色扮演游戏,我想拥有一个地图视图和一个战斗画面。 With the possibility of other screens as well. 以及其他屏幕的可能性。

I thought the best way to achieve this was to use multiple NIB files. 我认为实现此目标的最佳方法是使用多个NIB文件。

When I prototyped this by have one view that creates content, switching to the next view, and then back, the content on the original view was reset. 当我通过一个创建内容的视图进行原型设计时,切换到下一个视图,然后返回,原始视图上的内容被重置。

How do I make it so that the first view doesn't reset the data each time it's loaded? 如何使第一个视图在每次加载时都不会重置数据?

Your question is a little vague. 您的问题有点含糊。 A view usually does not get "reset" unless you run into a low memory warning. 除非遇到内存不足警告,否则视图通常不会“重置”。 That said, even then it's just up to you to keep the right references and setup your view correctly. 就是说,即使那样,您仍然需要保留正确的引用并正确设置视图。 Maybe have a read through Apple documentation or provide some code. 可能已通读Apple文档或提供了一些代码。 Adrian also has a good write-up about this. 阿德里安(Adrian)也对此有很好的记录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM