### LargeImageDownsizing ###
This code sample demonstrates a way to support displaying very large images in limited memory environments by turning a large image on disk into a smaller image in memory. This is useful in situations where the original image is too large to fit into memory as required for it to be displayed.
Having useful implications in supporting user defined documents, it should be noted that the photo roll or document sharing drop are the locations that a large image would exist. For simplicity this sample reads a large image from the bundle.
Supported formats are: PNG, TIFF, JPEG. Unsupported formats: GIF, BMP, interlaced images.
Note: constants are defined in LargeImageDownsizingViewController.m that are stable yet reasonably performant given memory availability for those individual iOS devices. Therefore, you may need to adjust these settings before running on your device.
The constants demonstrate parameters to the algorithm and are intended as initial/sample values only. In your application, reasonable values could be chosen at runtime based on the hardware profile of the target device, and the amount of memory taken by the rest of your application.
iOS SDK 4.3 or later
iOS OS 4.0 or later
The main view controller of the application. It kicks off the downsizing routine and updates an image view
showing the current progress as the resulting image is pieced together. When the downsize completes, the image
view is swapped out for a scroll view that contains the resulting image to allow for zooming and panning to
inspect the levels of detail of the resulting image.
Subclass of UIScrollView that contains the large image and provides built in support for zooming and scrolling.
Subclass of UIView with layerClass method overridden to return a CATiledLayer. This provides built in support for tile-based rendering.
Application Entry point
Installs the main view controller.
Loaded automatically by the application. Creates the application's delegate, window, and superview.
CHANGES FROM PREVIOUS VERSIONS:
- First version.
Copyright (C) 2011 Apple Inc. All rights reserved.
© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-08-05)