Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种简单的方法可以将 NSView 层次结构(nsview 的父视图的父视图的父视图)返回到主窗口或中间的一个点?
谢谢
NSView *aView = myView; while ((aView = [aView superview])) { NSLog(@"%@", aView); }
对于该术语的任何定义,视图不一定与“主窗口”有任何关系,但是您可以通过简单地询问它来获取视图所在的窗口。