iOS: Performance of reloading UIImage(name:...) -
i have tableview , each row has icon. 90% of rows have same icon.
in cellforrowatindexpath method load image assets folder this:
var cellimage = uiimage(named: "myimage")
does pose performance problem? os somehow smart enough it's same image each time? better if loaded image once , saved in class variable , assigned each time?
uiimage
's named:
api does kind of caching.
if @ uiimage's documentation, states:
use
init(named:in:compatiblewith:)
method (orinit(named:)
method) create image image asset or image file located in app’s main bundle (or other known bundle). because these methods cache image data automatically, recommended images use frequently.
Comments
Post a Comment