3

デバイスが横向きに回転したときに、カバーフロー スタイルのビューを横向きに表示する必要があるアプリに取り組んでいます。以前にいくつかのアプリに取り組んできましたが、横向き/回転を必要とするアプリはなかったので、経験がありません。カバーフロー ビューを描画するコードはありますが、表示するのは大変です。

私が望むのは、iPod アプリがカバーフローを表示するときの基本的な動作と同じです。下のビューは回転しませんが、カバーフローは上でフェードインし、回転して縦向きに戻すとフェードアウトします。

shouldAutorotateToInterfaceOrientation とモーダル ビューがフェード トランジションで表示されるか、ここにあるテクニックを使用することと関係があると思います。

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

私の主な問題は、モーダル ビューが表示されているが、コンテンツが横向きに回転していないことだと思います。私は何をすべきか?

これが私が今使っているコードです:

親ビュー

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

}

モーダルビュー

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

}

4

1 に答える 1

1

内部でトランジションを行う必要があります:

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

}
于 2011-03-04T19:06:04.437 に答える