0

私はiPadアプリに取り組んでいます。ポップオーバーコントローラーに表示したいビューコントローラーがあります。しかし、モーダルビューで表示するときにポップオーバーにカスタム アニメーションを追加したいとも考えています。モーダル ビューを表示および非表示にしているときに、カスタム アニメーションをポップオーバーに追加するにはどうすればよいですか?

以下は私のコードです:

Myviewcontroller *myViewController = [[Myviewcontroller alloc] initWithNibName:@"Myviewcontroller" bundle:nil];
UINavigationController *navController=[[UINavigationController alloc] initWithRootViewController:myViewController];
myViewController.contentSizeForViewInPopover=CGSizeMake(900, 600);
UIPopoverViewController popOVer = [[UIPopoverController alloc]
                initWithContentViewController:navController];
 [popover presentPopoverFromRect:CGRectMake(37, 90, 950, 560) inView:self.view permittedArrowDirections:0 animated:NO];

上記の popoverViewController に追加したいアニメーションは次のとおりです。

CABasicAnimation* rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat:(2 * M_PI) * 3]; // 3 is the number of 360 degree rotations

rotationAnimation.duration = 1.0f;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];

CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.fromValue = [NSNumber numberWithFloat:0.0];
scaleAnimation.toValue = [NSNumber numberWithFloat:1.0];
scaleAnimation.duration = 1.0f;
scaleAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];

CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
animationGroup.duration = 1.0f;
[animationGroup setAnimations:[NSArray arrayWithObjects:rotationAnimation, scaleAnimation, nil]];

今私の問題は、このアニメーションを popOverViewController 自体に追加する方法です。ポップオーバーにはビュー プロパティがないため、アニメーションを追加できません。ポップオーバー内のビューコントローラーにアニメーションを追加すると、ポップオーバーはその場所にとどまり、その中のビューがアニメーション化され、見栄えが悪くなります。

4

1 に答える 1

0

できません。ポップオーバーはビュー コントローラーではありません。

于 2011-07-19T13:52:36.427 に答える