2

Is it good practice to use an NSSplitView as the root view for a view controller? I am relatively new to Objective-C OSX development and can not seem to find an answer regarding this topic. I noticed that NSViews were created by default as the root view in IB but I normally remove it and assign a new NSSplitView as the root view for a view controller that needs a multi-pane layout. Any OSX veterans out there know if this is ok? I am trying to keep nested views to a minimum.

4

1 回答 1

0

使用 NSSplitView 作为视图控制器的根视图是一种好习惯吗?

我想说尝试使您的 Window 的根视图成为 NSSplitView 不一定是好或坏的做法(特别是因为 NSWindow 的设计者声明它的rootView属性是完全独立于类型的(id))。可以提出一个论点,即更扁平的视图层次结构总是一件好事。但是,话又说回来,也可以提出这样的论点,即 NSWindow 的设计者希望它rootView尽可能接近 NSView。无论哪种方式,请确保您的代码反映此更改并rootView在适当的情况下转换值。

于 2013-03-09T00:45:38.620 回答