Browse files

[css] allow single view refresh, and a comment for posterity

  • Loading branch information...
1 parent dc990f3 commit 36f7c8446981c03e7ab2dc19dd3a954e504cd569 @djMax djMax committed Mar 4, 2013
Showing with 18 additions and 3 deletions.
  1. +10 −3 src/css/src/NIDOM.h
  2. +7 −0 src/css/src/NIDOM.m
  3. +1 −0 src/css/src/UIView+NIStyleable.m
View
13 src/css/src/NIDOM.h
@@ -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;
@@ -160,14 +161,20 @@ _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
* in the future.
View
7 src/css/src/NIDOM.m
@@ -289,6 +289,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
{
if (![viewId hasPrefix:@"#"]) { viewId = [@"#" stringByAppendingString:viewId]; }
View
1 src/css/src/UIView+NIStyleable.m
@@ -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) {

0 comments on commit 36f7c84

Please sign in to comment.