Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force child views to inherit none style #150

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NUI/Core/NUISwizzler.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ @implementation NUISwizzler

- (void)swizzleAll
{
[self swizzleWillMoveToWindow:[UIView class]];

[self swizzleDidMoveToWindow:[UIBarButtonItem class]];
[self swizzleDidMoveToWindow:[UIButton class]];
[self swizzleDidMoveToWindow:[UILabel class]];
Expand Down Expand Up @@ -44,6 +46,11 @@ - (void)swizzleAwakeFromNib:(Class)class
[self swizzle:class methodName:@"awakeFromNib"];
}

- (void)swizzleWillMoveToWindow:(Class)class
{
[self swizzle:class methodName:@"willMoveToWindow:"];
}

- (void)swizzleDidMoveToWindow:(Class)class
{
[self swizzle:class methodName:@"didMoveToWindow"];
Expand Down
16 changes: 16 additions & 0 deletions NUI/UI/UIView+NUI.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ - (void)override_didMoveToWindow
[self override_didMoveToWindow];
}

-(void)override_willMoveToWindow:(UIWindow *)newWindow
{
if ([self.nuiClass isEqualToString:@"none"]){
[self disableNUI:self];
}
[self override_willMoveToWindow:newWindow];
}

-(void)disableNUI:(UIView*)view{
for (UIView* vw in view.subviews) {
[vw setNuiClass:@"none"];
[self disableNUI:vw];
}
}


- (void)setNuiClass:(NSString*)value {
objc_setAssociatedObject(self, "nuiClass", value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
Expand Down