Skip to content

Commit

Permalink
[css] allow single view refresh, and a comment for posterity
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Metral committed Mar 4, 2013
1 parent dc990f3 commit 36f7c84
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/css/src/NIDOM.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ _dom = [[NIDOM alloc] initWithStylesheet:stylesheet];
- (void)unregisterView:(UIView *)view;
- (void)unregisterAllViews;
- (void)refresh;
- (void)refreshView: (UIView*) view;

-(UIView*)viewById: (NSString*) viewId;

Expand Down Expand Up @@ -160,13 +161,19 @@ _dom = [[NIDOM alloc] initWithStylesheet:stylesheet];
/** @name Re-Applying All Styles */

/**
* Reapplies the stylesheet to all views.
*
* This only needs to be called if the stylesheet has changed.
* Reapplies the stylesheet to all views. Since there may be positioning involved,
* you may need to reapply if layout or sizes change.
*
* @fn NIDOM::refresh
*/

/**
* Reapplies the stylesheet to a single view. Since there may be positioning involved,
* you may need to reapply if layout or sizes change.
*
* @fn NIDOM::refreshView:
*/

/**
* Removes the association of a view with a CSS class. Note that this doesn't
* "undo" the styles that the CSS class generated, it just stops applying them
Expand Down
7 changes: 7 additions & 0 deletions src/css/src/NIDOM.m
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ - (void)refresh {
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)refreshView:(UIView *)view {
for (NSString* selector in [_viewToSelectorsMap objectForKey:[self keyForView:view]]) {
[self refreshStyleForView:view withSelectorName:selector];
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
-(UIView *)viewById:(NSString *)viewId
{
Expand Down
1 change: 1 addition & 0 deletions src/css/src/UIView+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ - (NSString*)applyOrDescribe: (BOOL) apply ruleSet: (NICSSRuleset*) ruleSet inDO
}
}
// TODO - should specifying both left/right or top/bottom set the width instead?
// TODO - how does left/right/top/bottom interact with relative positioning if at all?
if ([ruleSet hasRight]) {
NICSSUnit u = ruleSet.right;
switch (u.type) {
Expand Down

0 comments on commit 36f7c84

Please sign in to comment.