Question

I'm working on an app that will need to display a coverflow style view in landscape when the device is rotated to landscape orientation. I've worked on a few apps before, but none of them required landscape/rotation so I'm not experienced with it. I have the code to draw the coverflow view, but presenting it is proving tough.

What I'd like is basically like what the iPod app does when displaying coverflow. The view underneath does not rotate, but the coverflow fades in on top, and fades out when rotated back to portrait.

I'm guessing it's something to do with shouldAutorotateToInterfaceOrientation and a modal view being presented with a fade transition, or using the technique found here:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/22285-replicating-cool-ipod-landscape-transition-iphone.html

I guess my main problem is that the modal view is presented, but it's contents are not rotated to landscape. What should I do?

Here's the code I'm using now:

PARENT VIEW

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
NSLog(@"rotating?");
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
    return YES;
}
if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
    NSLog(@"rotating");
    CoverFlowViewController *coverFlowView = [[CoverFlowViewController alloc] init];
    [coverFlowView setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [self presentModalViewController:coverFlowView animated:YES];
    [coverFlowView release];
}
return YES;

}

MODAL VIEW

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
NSLog(@"rotating? going back?");
if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
    return YES;
} else {
    [self.parentViewController dismissModalViewControllerAnimated:YES];
}
return NO;

}

Was it helpful?

Solution

You should do the transition inside:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top