Configuring Image Caching

Waiting for snapshots at startup

The snapshotter takes time to run and it can make your app feel sluggish while building the snapshots, especially if your markup is complicated and highly interactive. You can force Pugpig to wait until it has pre-cached a certain number of pages before the user can interact with your app. The trade-off is startup time vs. fluidness. For example, if you pre-snapshotted your entire book it would take a long time to start but once the app was running there would be no hiccups while the snapshotter finished because there would be no more work for it to do.

Note that if you're caching to disk, this delay will only happen if you don't have enough snapshots cached up already. This is usually only happen the first time you run the app. Once all the pages have been snapshotted once, the snapshotter has nothing more to do and it won't run.

The number of pages to snapshot can be set in your application delegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [viewController.pageControl hideUntilInitialised:3];
  // 3 pages is the default. adjust this number to snapshot more or less.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk