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 trial

iOS

How can I achieve the following effect?

If you have seen the Spotify-app, you've probably seen something like this:

http://imgur.com/HejeaXd

and

http://imgur.com/evgnI3K

In the last picture they're sort of displaying two viewControllers at once. Is there a particular way to achieve this, or is it basically to, within one of your viewControllers, create an instance of the other viewController you want to be displayed, then add in on as a subview with it's specific CGRect?

I'd love some tips as to what's the best approach.

Also, I came over this addChildViewController:(UIViewController *) - method. When is appropriate to use this? I looked at the documentation, but still, I didn't completely understand it

Thanks!

2 Answers

you can add child view controllers to other view controllers. see this

though im not so sure that will achieve what you want.

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Are you referring to the "side menu"? There isn't anything built into the iOS SDK, but there are lots of 3rd party solutions on GitHub and elsewhere. Here's one novel approach for iOS 7: http://uxmag.com/articles/adapting-ui-to-ios-7-the-side-menu