• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSViewController subclass return type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSViewController subclass return type


  • Subject: Re: NSViewController subclass return type
  • From: Tom Davie <email@hidden>
  • Date: Thu, 11 Jul 2013 08:58:03 +0200

On Jul 11, 2013, at 8:27 AM, Quincey Morris <email@hidden> wrote:

> 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.

Except that view is a read/write property, and this is a type error, because of this situation:

UIVCSubclass *s = [[UIVCSubclass alloc] init...];
UIViewController *vc = s;
[vc setView:[[[UIView alloc] init] autorelease];

Tom Davie
_______________________________________________

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


References: 
 >NSViewController subclass return type (From: email@hidden)
 >Re: NSViewController subclass return type (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: NSViewController subclass return type
  • Next by Date: Re: NSViewController subclass return type
  • Previous by thread: Re: NSViewController subclass return type
  • Next by thread: Custom drag image for NSTableView selections
  • Index(es):
    • Date
    • Thread