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

View Controller Transitions - Extra Credit

Hello all,

I would really like to know how to do this particular extra credit task, any help would be appreciated. Here is the task at hand: Instead of the fade-in transition, try moving-in the detail view controller from the side. Thanks!

2 Answers

Hello Tyler,

check out the wwdc 14 on custom transitions, i checked it out and they should answer your question, and if not you can probably google it.

Best, Kai.

Thanks will do!

I sort of managed to do this by setting the initial frame.origin.x to -320 and then setting the detail.view.frame to containerView.bounds in the completed transition.

CGRect frame = containerView.bounds;
    frame.origin.x -= 320.0;

    detail.view.frame = frame;
    [containerView addSubview:detail.view];

    [UIView animateWithDuration:1.0 animations:^{
        detail.view.frame = containerView.bounds;
    } completion:^(BOOL finished) {
        [transitionContext completeTransition:YES];
    }];

However it's not perfect as the background slides in as expected, but then the image pops in once it's loaded at full size. If you dismiss the animation and then open the image again it works perfectly as the image has already loaded, but I'd appreciate feedback as to how to get it looking good first time.

One solution could be to load all of the grid images as standard_resolution rather than thumbnails, but this is almost certainly not the right way to do this...

Thanks!