IPhone: reusing UIViewControllers to save memory

What are the best ways to reuse UIViewControllers? In many applications (including Apple’s own examples: for example, SQLiteBooks), UIViewControllers are allocated and initialized each time, the UIViewController is pushed onto the stack. This increases memory usage with each new controller as objects remain in memory and are no longer used.

How to make it better?

+3
source share
5 answers

This is what I do when creating a new view manager and free up memory when deleting a view from a window

MyViewController *mvc = [[[MyViewController alloc] initWithNibName:@"MyView" bundle:nil] autorelease];
[[self navigationController] pushViewController:mvc animated:YES];
+1

, .

, , , - . , dealloc .

, , , , , ( , ). .

, , .

+4

, , ? , , , .

+1

dealloc , , . . ( LostInTransit ), .

, dealloc , , - .

+1

, View Viewer .

, , , . , , , viewDidUnload ( - 3.0).

, , ( ), . , , ( ).

+1

Source: https://habr.com/ru/post/1711062/


All Articles