I am loading a UIImage of size 2480 × 3508 into UIImageView using UIViewContentModeScaleAspectFit. I am getting memory warning while loading this image. And after i loaded a few images of this size in this UIImageView the application crashes. Is there any method to solve this.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- SwiftUI: UIImage (QRCode) does not load after call
- how do you prevent page scroll in textarea on mobi
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Custom Marker performance iOS, crash with result “
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
Solution to this problem consists of either loading scaled version of the image (*1) or you have option to display it in full resolution with help of CATiledLayer(*2).
Addendum: If your image source is Photo Library, ALASSet provides already scaled image to full screen and full resolution image. You can use combination of both with CATiledLayer. Full screen image is added to layer beneath the CATiledLayer to serve as placeholder while you're waiting for tiles in CATiledLayer to load.
You can use this for scaling The method is described simply in the following link:
How to scale a UIImageView proportionally?
Well, according to the documentation :
Reduce your image then load it in your ImageView, there are plenty of libraries to do this, here is one :
https://github.com/Nyx0uf/NYXImagesUtilities