Add rs_enclosingTableView method as NSView category.

This commit is contained in:
Brent Simmons 2018-02-09 21:33:13 -08:00
parent 765a91dd34
commit 1b09d35c77
2 changed files with 15 additions and 0 deletions

View File

@ -27,5 +27,6 @@
- (NSRect)rs_rectCentered:(NSRect)originalRect;
- (NSTableView *)rs_enclosingTableView;
@end

View File

@ -65,4 +65,18 @@
}
- (NSTableView *)rs_enclosingTableView {
NSView *nomad = self.superview;
while (nomad != nil) {
if ([nomad isKindOfClass:[NSTableView class]]) {
return nomad;
}
nomad = nomad.superview;
}
return nil;
}
@end