objective c - correct way to manage memory of a big scrollview with multiple subviews -


i still new objective c.

i have created ipad app. large horizontal scrollview 6 subviews in it.

currently is, init subviews @ beginning once , all.

when use activity monitor profile app, shows tat:

real memory: 65-75mb virtual memory: 152.63mb

i considering whether should optimize app have lower memory footprint. know in mind there 3 ways of initing subviews

  • init @ beginning, views alive , kept in memory until app closed. doesnt efficient since there no deallocation , reallocation, there's no chance memory leak. (what m doing now)
  • init 1 view @ time, when u leave view, not destroy when view revisited there no need reinit again
  • init 1 view @ time, when u leave view, destroy immediately. when revisted, have realloc again.

what common approach / best practise in doing this?

to know better way handle memory issue can refer link. refer page control example, explain best way of reusing same view multiple times.

- (void)scrollviewdidscroll:(uiscrollview *)scrollview { if (scrollview.contentoffset.x > 0 && scrollview.contentoffset.x < view2.view.frame.origin.x) { perform condition } } 

Comments