Click here to support Nimbus development and make a donation at www.pledgie.com !
An iOS framework whose growth is bounded by O(documentation).
NIDOM Class Reference

Overview

A leight-weight DOM-like object to which you attach views and stylesheets.

To be clear: this is not an HTML DOM, but its intent is the same. NIDOM is designed to simplify the view <=> stylesheet relationship. Add a view to the DOM and it will automatically apply any applicable styles from the attached stylesheet. If the stylesheet changes you can refresh the DOM and all registered views will be updated accordingly.

Example Use

NIDOM is most useful when you create a single NIDOM per view controller.

NIStylesheet* stylesheet = [stylesheetCache stylesheetWithPath:@"root/root.css"];
// Create a NIDOM object in your view controller.
_dom = [[NIDOM alloc] initWithStylesheet:stylesheet];

You then register views in the DOM during loadView or viewDidLoad.

// Registers a view by itself such that only "UILabel" rulesets will apply.
[_dom registerView:_label];

// Register a view with a specific CSS class. Any rulesets with the ".background" scope will
// apply to this view.
[_dom registerView:self.view withCSSClass:@"background"];

Once the view controller unloads its view you must unregister all of the views from your DOM.

- (void)viewDidUnload {
  [_dom unregisterAllViews];
}

Definition at line 61 of file NIDOM.h.

Methods

Creating NIDOMs
(id) - initWithStylesheet:
(id) + domWithStylesheet:
(id) + domWithStylesheetWithPathPrefix:paths:
Registering Views
(void) - registerView:
(void) - registerView:withCSSClass:
(void) - unregisterView:
(void) - unregisterAllViews
Re-Applying All Styles
(void) - refresh

Method Documentation

- (id) initWithStylesheet: (NIStylesheet *)  stylesheet

Initializes a newly allocated DOM with the given stylesheet.

Definition at line 71 of file NIDOM.m.

+ (id) domWithStylesheet: (NIStylesheet *)  stylesheet

Returns an autoreleased DOM initialized with the given stylesheet.

Definition at line 40 of file NIDOM.m.

+ (id) domWithStylesheetWithPathPrefix: (NSString *)  pathPrefix
paths: (NSString *)  path
,   ... 

Returns an autoreleased DOM initialized with a nil-terminated list of file paths.

Definition at line 46 of file NIDOM.m.

- (void) registerView: (UIView *)  view

Registers the given view with the DOM.

The view's class will be used as the CSS selector when applying styles from the stylesheet.

Definition at line 116 of file NIDOM.m.

- (void) registerView: (UIView *)  view
withCSSClass: (NSString *)  cssClass 

Registers the given view with the DOM.

The view's class as well as the given CSS class string will be used as the CSS selectors when applying styles from the stylesheet.

Definition at line 126 of file NIDOM.m.

- (void) unregisterView: (UIView *)  view

Removes the given view from from the DOM.

Once a view has been removed from the DOM it will not be restyled when the DOM is refreshed.

Definition at line 137 of file NIDOM.m.

- (void) unregisterAllViews

Removes all views from from the DOM.

Definition at line 144 of file NIDOM.m.

- (void) refresh

Reapplies the stylesheet to all views.

This only needs to be called if the stylesheet has changed.

Definition at line 151 of file NIDOM.m.

Generated for Nimbus by doxygen 1.7.4-20110629