Display view controller's view using custom animation iOS
I have a button that, when pressed, presents a view controller to the user. I currently do this using a method like this:
ProjectViewController *myProj = [[ProjectViewController alloc] init];
myProj.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
myProj.modalPresentationStyle = UIModalPresentationFullScreen;
UINavigationController *navController = [[UINavigationController alloc] init开发者_如何学编程WithRootViewController:myProj];
[self presentModalViewController:navController animated:YES];
[myProj release];
[navController release];
I would like to present this new view to the user as a growing rectangle from the middle of the screen. What is the best way of doing this? Cheers
Try the undocumented transition style zoomyIn
/zoomyOut
If those are not the ones you are looking for, set the frame of the view to the center of the view with 0 width/height and transform it to it's final size and position. Untested sample code:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.7];
yourview.frame = finalFrame;
[UIView commitAnimations];
精彩评论