this is probably a newbie question...
I'm trying to reduce the amount of memory usage in my iPhone app.
I have an UIViewController with a set of buttons. When the user taps any of them, the app takes him to a new screen (new UIViewController).
Should I create them on demand ([[MyUIViewController alloc] initWithNibName:@"MyUIViewController" bundle:nil];), or should I have all these UIViewControllers as @property
s in the "main" controller, and create them only the first time? (check if they are nil
).
I noticed (with Instruments
) that, following the first approach, the used memory (Live bytes) increases on push but does not decrease when pulling the controller, and so on every time I press a button.
Furthermore, does that also applies to UITableViews, where I push another UIViewController in tableView:didSelectRowAtIndexPath:
method?
Thank you in advance.
EDIT: I'm using ARC