Search code examples
cocoasuperview

NSView - get superview hierarchy


Is there a simple way to walk back up the NSView hierarchy (superview of superview of superview of nsview) to the main window or a point in between?

Thanks


Solution

  • NSView *aView = myView;
    while ((aView = [aView superview])) {
        NSLog(@"%@", aView);
    }