Search code examples
iosios5uikituistoryboard

iOS 5 Storyboard segue to replicate the Music app's album tracks view


I'd like to replicate the behavior of the iPhone's Music app. When you're playing an album in that app and you tap the upper right button the album cover flips around to show a UITableView of tracks behind it.

Is it possible to accomplish this with a custom UIStoryboardSegue?

Or is the best way just to flip between two views that use the same controller?


Solution

  • It is probably simpler to flip between two views of the same view controller, e.g.

    - (IBAction)showTracksView
    {
        [UIView transitionWithView:self.view 
                      duration:1.0 
                       options:UIViewAnimationOptionTransitionFlipFromLeft 
                    animations:^{ tracksView.hidden = NO; } 
                    completion:^(BOOL finished){ self.navigationItem.title = @"Tracks"; }];
    }
    
    - (IBAction)hideTracksView
    {
        [UIView transitionWithView:self.view 
                      duration:1.0 
                       options:UIViewAnimationOptionTransitionFlipFromLeft 
                    animations:^{ tracksView.hidden = YES; } 
                    completion:^(BOOL finished){ self.navigationItem.title = @"Album cover"; }];
    }
    

    where tracksView is your UITableView of tracks.