Re: NSViewController subclass return type
Re: NSViewController subclass return type
- Subject: Re: NSViewController subclass return type
- From: Quincey Morris <email@hidden>
- Date: Wed, 10 Jul 2013 23:27:08 -0700
On Jul 10, 2013, at 23:18 , email@hidden wrote:
> Is there an appropriate way to subclass NSViewController to return a custom view class or is casting the return of view or loadView the only way?
You can just re-declare the 'view' property in a subclass to have the desired return type. In the implementation, you can provide an override that simply calls super, or you can cheat slightly by using '@dynamic view' in the subclass to make it use the superclass implementation.
> Is it even worth using on OS X since there are so few built in methods? Is it more practical to just load views from nibs without NSViewController?
There's not a lot in it, but NSViewController has code for managing ownership of the top-level view objects, it has a convenient 'representedObject' property, and of course it implements 'loadView'. It's probably worth using even for these minor benefits.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden