UIPopoverViewController presentModalViewController animation
I am working on an iPad app. I have a viewcontroller which I want to show in a popover controller. But I also want to add custom animation to popover when presenting it in modalview. How can I add custom animation to the popover while presenting and dismissing the modal view?
Below is my code:
Myviewcontroller *myViewController = [[Myviewcontroller alloc] initWithNibName:@"Myviewcontroller" bundle:nil];
UINavigationController *navController=[[UINavigationController alloc] initWithRootViewController:myViewController];
myViewController.contentSizeForViewInPopover=CGSizeMake(900, 600);
UIPopoverViewController popOVer = [[UIPopoverController alloc]
开发者_如何学JAVA initWithContentViewController:navController];
[popover presentPopoverFromRect:CGRectMake(37, 90, 950, 560) inView:self.view permittedArrowDirections:0 animated:NO];
The animation which I want to add to the above popoverViewController is:
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]];
Now my problem is how do I add this animation to the popOverViewController itself. since the Popover doesn't have any view property, I am not able to add any animation to it. If I add animation to the viewcontroller inside the popover, then the popover stays at its place and the view inside it animates which does not look good.
Can't be done, a popover is not a view controller.
精彩评论