iphone - classes, objects and memory consumption -


suppose have application draw 20 little uiimageviews on screen. suppose 20 playing cards faced down. so, have same image 20 times on screen.

suppose have 2 cases:

case 1

i have method not on class loads card texture, applies uiimageview , positions on screen. method run 20 times, cards put on screen image views.

case 2

i have class once initialized load card background image, apply uiimageview , deliver object.

suppose want animate 20 cards, using simple uiimageview translation.

looking point of view of memory consumption, cpu load , run time execution of 2 cases mentioned lighter application , consume less memory?

thanks.

almost doesn't matter. real constraint views , gpu memory, same because you're still creating same 20 uiimageviews. setup cost minuscule in either case in of categories mention. , 20 images no problem either. make sure images sized reasonably. , load them uiimage's +imagenamed: method take advantage of caching in frameworks.

you can profile instruments (via xcode) if you'd determine specific performance differences.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -