これは、2つのブロックで実行できます。
// Rotate the second 'backside' view to 90 degrees and hide it
CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0f / -zDistance;
mySecondView.layer.transform = transform;
mySecondView.layer.transform = CATransform3DMakeRotation(M_PI / 2, -1, 0, 0);
mySecondView.hidden = YES;
// Animate to 90 degrees
[UIView animateWithDuration:0.5 animations:^{
CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0f / -zDistance;
myView.layer.transform = transform;
myView.layer.transform = CATransform3DMakeRotation(M_PI / 2, -1, 0, 0);
} completion:^{
// Switch to the backside view
myView.hidden = YES;
mySecondView.hidden = NO;
// Animate the remaining 90 degrees
[UIView animateWithDuration:0.5 animations:^{
CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0f / -zDistance;
mySecondView.layer.transform = transform;
mySecondView.layer.transform = CATransform3DMakeRotation(M_PI, -1, 0, 0);
}
}
ビューの背面を非表示にするプロパティを試してみることもできmyView.layer.isDoubleSided
ます。ただし、アニメーションの最後でフラグを切り替える必要がありますhidden
。そうしないと、最初のビューのボタンをクリックできます。
お役に立てれば!ありがとう。