I know the difference between UIImage(named:String)
and UIImage(contentsOfFile:String)
,and I just have over 200MB images saved into Images.xcassets folder. I found that there is a huge memory usage of my app(over 500 MB),so I consider using UIImage(contentsOfFile:String)
constructor,because it does not cache image. And I googled a lot and found the following solution.
myImageView.image = UIImage(contentsOfFile: NSBundle.mainBundle().pathForResource("my_img_name",ofType:"png"))
Howerver, when it runs, the app crashed. Here is the link that might relate to my question:Access Asset Catalog pathForResource