The iOS framework that grows only as fast as its documentation
NIStylesheetCache Class Reference

Overview

A simple in-memory cache for stylesheets.

It is recommended that you use this object to store stylesheets in a centralized location. Ideally you would have one stylesheet cache throughout the lifetime of your application.

Using a stylesheet cache with Chameleon

A stylesheet cache must be used with the Chameleon observer so that changes can be sent for a given stylesheet. This is because changes are sent using the stylesheet object as the notification object, so a listener must register notifications with the stylesheet as the object.

NIStylesheet* stylesheet = [stylesheetCache stylesheetWithPath:@"common.css"];
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(stylesheetDidChange)
object:stylesheet];

Tasks

NSString * pathPrefix property
 
(id) - initWithPathPrefix:
 
(NIStylesheet *) - stylesheetWithPath:loadFromDisk:
 
(NIStylesheet *) - stylesheetWithPath:
 

Method Documentation

pathPrefix

The path prefix that will be used to load stylesheets.

@property (nonatomic, readonly, copy) NSString* pathPrefix;

initWithPathPrefix:

Initializes a newly allocated stylesheet cache with a given path prefix.

- (id)initWithPathPrefix:(NSString *)pathPrefix;

stylesheetWithPath:loadFromDisk:

Fetches a stylesheet from the in-memory cache if it exists or loads the stylesheet from disk if loadFromDisk is YES.

- (NIStylesheet*)stylesheetWithPath:(NSString *)path loadFromDisk:(BOOL)loadFromDisk;

stylesheetWithPath:

Fetches a stylesheet from the in-memory cache if it exists or loads the stylesheet from disk.

- (NIStylesheet*)stylesheetWithPath:(NSString *)path;
Discussion

Short form for calling [cache stylesheetWithPath:path loadFromDisk:YES]