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


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.


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

Method Documentation


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

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

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


The given ruleset should be applied to the view.

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

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


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

- (NSArray*)pseudoClasses;

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.


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

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

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


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

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

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.