Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[css] Styled builder will now set properties on the DOM target if the…

…y exist for a view's id. This allows JSON-based view building to set view controller properties.
  • Loading branch information...
commit a49f19f4aea75cb80b0d33e59ce6148ffaa0dbf7 1 parent f357b9d
Max Metral authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/css/src/UIView+NIStyleable.m
View
10 src/css/src/UIView+NIStyleable.m
@@ -574,6 +574,16 @@ -(NSArray *)buildSubviews:(NSArray *)viewSpecs inDOM:(NIDOM *)dom
NIPrivateViewInfo *viewInfo = [subviews objectAtIndex:ix];
NSString *firstClass = [viewInfo.cssClasses count] ? [viewInfo.cssClasses objectAtIndex:0] : nil;
[dom registerView:viewInfo.view withCSSClass:firstClass andId:viewInfo.viewId];
+ if (viewInfo.viewId && dom.target) {
+ NSString *selectorName = [NSString stringWithFormat:@"set%@%@:", [viewInfo.viewId substringWithRange:NSMakeRange(1, 1)], [viewInfo.viewId substringFromIndex:2]];
+ SEL selector = NSSelectorFromString(selectorName);
+ if ([dom.target respondsToSelector:selector]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+ [dom.target performSelector:selector withObject:viewInfo.view];
+#pragma clang diagnostic pop
+ }
+ }
if (viewInfo.cssClasses.count > 1) {
for (int i = 1, cct = viewInfo.cssClasses.count; i < cct; i++) {
[dom addCssClass:[viewInfo.cssClasses objectAtIndex:i] toView:viewInfo.view];
Please sign in to comment.
Something went wrong with that request. Please try again.