Re: Subclassing a View Controller in a Storyboard
Re: Subclassing a View Controller in a Storyboard
- Subject: Re: Subclassing a View Controller in a Storyboard
- From: David Duncan <email@hidden>
- Date: Wed, 04 Sep 2013 13:12:17 -0700
The point is, if the only difference between an LTWMusicViewController and an LTWRockMusicViewController is that the latter defaults to the “Rock” category, then you don’t actually *need* the LTWRockMusicViewController subclass. You just need to ensure that when you want an LTWMusicViewController created with the Rock category, that you ensure it is set as such.
So in -prepareForSegue, you get the instance of LTWMusicViewController that is about to be transitioned to, set its category to Rock, and your done. No need for subclassing at all.
On Sep 4, 2013, at 1:08 PM, Dave <email@hidden> wrote:
>> You could do that, but OP is using storyboards. In that case, the proper way to pass that info is in -prepareForSegue:.
>
> I took a look at prepareForSegue, but I'm not sure how it would help here?
>
> In the Storyboard I have a VC with a name of "LTWMusicViewController", there is NOT a "LTWRockMusicViewController".
>
> when LTWMusicViewController - viewDidLoad gets called it sets the category to ALL.
>
> when LTWRockMusicViewController - viewDidLoad gets calls [super viewDidLoad] (in LTWMusicViewController), THEN set the Category to Rock.
>
> In LTWRockMusicViewController, I want all the functionality and Views etc. of LTWMusicViewController BUT I want to set the to Rock.
>
> Since LTWRockMusicViewController is not in the Story board, I can't instantiate it and so prepareForSegue won't be called.
>
> I could define prepareForSegue in LTWMusicViewController, BUT I don't want to do anything special with this VC, I want to do it to LTWRockMusicViewController.
>
> Thanks for your help.
>
> All the Best
> Dave
>
>
>
>
> _______________________________________________
>
> 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
--
David Duncan
_______________________________________________
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