How to display the style of landscape coverage when turning the device?

I am working on an application that will need to display in landscape style in landscape mode when the device rotates in landscape orientation. I used to work on several applications, but none of them required landscape / rotation, so I did not experience this. I have some code to draw a view of the cover, but presenting it has proven difficult.

What I would like is basically what the iPod application does when displaying the cover art. The bottom view does not rotate, but the ceiling hides from above and disappears when you turn back to the portrait.

I assume this has something to do with shouldAutorotateToInterfaceOrientation and the modal view presented with a change in transition or using the technique found here:

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

I believe my main problem is that the modal view is presented, but its contents do not rotate to landscape view. What should I do?

Here is the code I'm using now:

PARENTAL 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;

}

+3
source share
1 answer

You should go inside:

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

}
+1
source

Source: https://habr.com/ru/post/1784470/


All Articles