tombenner/nui — pull request #65 by huguesbr (2013-01-24 17:45:45+00:00)
Title: Exclude some views or views' hierarchy from being render by NUI

### Context

Ideally NUI CSS Parse will have a better CSS Selector support but until then it's pretty hard to exclude some views from being render.
You can of course set nuiClass = @"none" but what about view (or subviews) for which you don't have a direct access to (ABPeoplePickerNavigationController, ...).
In my case, if I use one of the default theme and display a person picker, I can't see contacts name.

### Proposed Solution

I've added two new css property (exclude-views and exclude-subviews) which allow to specify some view's class (or view's class subviews) that should never be render by NUI.
I've also added another gloabalExclusions property on NUISettings which will exclude views or subviews of specified class to be render.

### Usage

- New CSS Property

NUIStyle.css
```css
...
Button {
background-color: #FFFFFF;
border-color: @primaryBorderColor;
border-width: @primaryBorderWidth;
font-color: @primaryFontColor;
font-color-highlighted: @secondaryFontColor;
font-name: @secondaryFontName;
font-size: 18;
height: 37;
corner-radius: 7;
exclude-views: UIAlertButton;
exclude-subviews: UITableViewCell,TDBadgedCell,UITextField;
}
...
```

- New Global Exclusions

```objective-c
int main(int argc, char *argv[])
{
@autoreleasepool {
#if kNUIEnabled
[NUISettings initWithStylesheet:@"NUIStyle-1debit"];
[NUISettings setGlobalExclusions:@[@"ABMemberCell", @"ABMultiCell"]];
#endif
return UIApplicationMain(argc, argv, nil, NSStringFromClass([HBRAppDelegate class]));
}
}
```

### Alternative solution

It also possible to only use nuiClass and having a new class call @"noneAll", and do a test on it in applyNui.

```Objective-C
- (void)applyNUI
{
// Styling shouldn't be applied to inherited classes
if ([self class] == [UIView class]) {
[self initNUI];
if (![self.nuiClass isEqualToString:@"none"]) {
BOOL isIncludedInNoneAllView;
UIView *superview = self;
while(superview != nil){
if([superview.nuiClass isEqualToString:@"NoneAll"]){
self.nuiClass = @"none";
}
superview = superview.superview;
}

if (![self.nuiClass isEqualToString:@"none"]) {
if ([self class] == [UIView class] &&
[[self superview] class] != [UINavigationBar class]) {
[NUIRenderer renderView:self withClass:self.nuiClass];
}
}

}
}
self.nuiIsApplied = [NSNumber numberWithBool:YES];
}
```

It will give less flexibility, be a bit more consuming (will escalate view hierarchy each first time nui is apply to any class).
If you like this solution better, let me know I will submit another pull request.