让我快点来发。到目前为止,我的代码没有问题。我唯一关心的是内存管理。让我让我的应用程序逻辑清晰。
即使我的 Live 字节最大为 5 MB,我也不知道它崩溃的原因。我从控制台和设备日志中得到的只是接收到的内存警告。使用仪器时无泄漏和无脏尺寸或常驻尺寸。
在模拟器中运行时,我仅在多个设备上才遇到此问题,但我遇到了此问题。
我有以下疑问
提前致谢 ...
最佳答案
所以你的问题:
Unknown reason to receive Memory Warning
第一个原因:
When App is launched globally NSmutableDictionary is declared and nearly 300 images are added to that Dictionary with various keys and images are added using pathForResource:ofType method.
第二个原因:
After my rootViewController loaded my 35 custom UIViews are added to same global dictionary with another key.(this rootViewController will not be used often)
其他问题:
Whether its good to add everything in global dictionary. My idea is to reduce the loading time for every ViewControllers
不,这不是... Lazy Initialization ?
for reusing same images can we use pathForResource or image named method..
你可以使用任何你想要的东西,只要你真正需要它时使用它。
关于ios - 收到内存警告的未知原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15548033/