开发者

xib with pictures or empty UIImageview with image designated in viewDidLoad

开发者 https://www.devze.com 2023-03-23 06:20 出处:网络
I have an app for iPad with a lot of images and I use core animation. Which is better at loading times?To load empty UIImageViews of the appropriate size and location from a nib and put the images wit

I have an app for iPad with a lot of images and I use core animation. Which is better at loading times? To load empty UIImageViews of the appropriate size and location from a nib and put the images within them as needed or in the viewDidLoad..

or to use the actual images in the nib file??

I have several, about 50, pictur开发者_C百科es that I have to load in a single nib, the images are called upon depending on user actions. Right now i set most of the images to "nil" in the viewDidLoad, but I am having memory problems. I wonder if this is the cause? Some images are small.. approx 10KB and couple are big approx. 500KB.

Thanks


Using xibs is always slower than programmatically. In addition to that, i won't recommend you to display every picture in a own UIImageView. CGLayers (as a UIView) are generally slow. In your case i would create a single UIView for the images and draw them directly to the graphics context of the view with [UIImage drawInRect: aRect] or [UIImage drawAtPoint: aPoint]. That should be a good way to max out the performance at low memory.

0

精彩评论

暂无评论...
验证码 换一张
取 消