开发者

xib with pictures or empty UIImageview with image designated in viewDidLoad

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜