UIPopoverViewController presentModalViewController动画

时间:2011-07-19 12:59:25

标签: ipad uiviewcontroller uipopovercontroller presentmodalviewcontroller caanimation

我正在开发一款iPad应用。我有一个viewcontroller,我想在弹出控制器中显示。但我还想在modalview中呈现自定义动画时添加自定义动画。任何人都可以解释如何在呈现和解除模态视图时向弹出窗口添加自定义动画。以下是我的代码。

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本身。由于Popover没有任何视图属性,我无法添加任何动画。如果我将动画添加到popover中的viewcontroller,那么popover将保持在其位置,并且其中的视图会动画显示效果不佳。如果有人有想法,请帮助我!!!!!

1 个答案:

答案 0 :(得分:0)

无法完成,弹出窗口不是视图控制器。