Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJack Raiden
7,976 PointsSam set the ToViewControllerKey to be a UIViewController but it is actually a THDetailviewController, is it a problem?
when implement the - (void)animateTransition method, Sam wrote the first line like this
UIViewController *detail=[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
but in fact, the destination view controller is THDetailviewController, should we instead write this way:
THDetailviewController *detail=[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
or maybe I am entirely wrong, because THDetailviewController is a subclass of UIViewController, so what Sam wrote is totally fine... my instinct tells this may be the case, but I really want to know what is going on beneath it...
1 Answer
Michael Hulet
47,913 PointsYour instinct is correct. Because THDetailViewController
inherits from UIViewController
, THDetailViewController
is technically also a UIViewController
therefore making this legal
Jack Raiden
7,976 PointsJack Raiden
7,976 PointsThanks ! Yours words clears up doubts for me .