The iOS framework that grows only as fast as its documentation
<NIStyleable> Protocol Reference

Overview

The protocol used by the NIStylesheet to apply NICSSRuleSets to views.

If you implement this protocol in a category it is recommended that you implement the logic as a separate method and call that method from applyStyleWithRuleSet: so as to allow subclasses to call super implementations. See UILabel+NIStyleable.h/m for an example.

Tasks

(void) - applyStyleWithRuleSet:
 
(void) - applyStyleWithRuleSet:inDOM:
 
(NSArray *) - pseudoClasses
 
(void) - applyStyleWithRuleSet:forPseudoClass:inDOM:
 
(NSString *) - descriptionWithRuleSet:forPseudoClass:inDOM:withViewName:
 

Method Documentation

applyStyleWithRuleSet:

Please implement applyStyleWithRuleSet:inDOM: instead to support relative positioning.

- (void)applyStyleWithRuleSet:(NICSSRuleset *)DEPRECATED_ATTRIBUTE;
Discussion

The deprecated warning will only catch calls to super rather than implementors, but not sure what else to do.

applyStyleWithRuleSet:inDOM:

The given ruleset should be applied to the view.

- (void)applyStyleWithRuleSet:(NICSSRuleset *)ruleSet inDOM:(NIDOM *)dom;
Discussion

The ruleset represents a composite of all rulesets in the applicable stylesheet.

pseudoClasses

Tells the CSS engine a set of pseudo classes that apply to views of this class.

- (NSArray*)pseudoClasses;
Discussion

In the case of UIButton, for example, this includes :selected, :highlighted, and :disabled. In CSS, you specify these with selectors like UIButton:active. If you implement this you need to respond to applyStyleWithRuleSet:forPseudoClass:

Make sure to include the leading colon.

applyStyleWithRuleSet:forPseudoClass:inDOM:

Applies the given rule set to this view but for a pseudo class.

- (void)applyStyleWithRuleSet:(NICSSRuleset *)ruleSet forPseudoClass:(NSString *)pseudo inDOM:(NIDOM *)dom;
Discussion

Thus it only supports the subset of properties that can be set on states of the view. (e.g. UIButton textColor or background)

descriptionWithRuleSet:forPseudoClass:inDOM:withViewName:

Return a string describing what would be done with the view.

- (NSString*)descriptionWithRuleSet:(NICSSRuleset *)ruleSet forPseudoClass:(NSString *)pseudo inDOM:(NIDOM *)dom withViewName:(NSString *)name;
Discussion

The current implementations return actual Objective-C using the view name as the message target. The intent is to allow developers to debug the logic, but also to be able to strip out the CSS infrastructure if desired and replace it with manual code.