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.

runewell
  • 23
  • 2

1 Answers1

0

Is it good practice to use an NSSplitView as the root view for a view controller?

I'd say it's not necessarily good or bad practice to try and make your Window's root view an NSSplitView (especially because the designers of NSWindow declared it's rootView property to be completely type-independent (id)). A argument can be made that flatter view hierarchies are always a good thing. But, then again, the argument also could be made that the designers of NSWindow intended it's rootView to be as close to an NSView as possible. Either way, make sure that your code reflects this change and casts the value of rootView where appropriate.

CodaFi
  • 43,043
  • 8
  • 107
  • 153
  • Ok thanks, I just wanted to make sure this wasn't a well-known mistake that beginners like me might make. So far all of my NSSplitview views are working fine as the root view. – runewell Mar 09 '13 at 03:47
  • The way I see it, you're just providing a subclass of NSView anyhow. It's all good. – CodaFi Mar 09 '13 at 05:04