dismissModalViewController中的自定义UIView动画

时间:2012-05-08 23:06:37

标签: objective-c ios uiviewcontroller catransition

放置自定义动画代码以解除modalviewcontroller的正确位置在哪里。

我尝试将以下内容放入viewdiddisappear,viewwilldisappear但行为不正确。有什么想法吗?谢谢!

[UIView beginAnimations:@"suck" context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:103 forView:self.navigationController.view cache:YES];
[UIView setAnimationPosition:CGPointMake(260, 431)];
[UIView commitAnimations];

2 个答案:

答案 0 :(得分:2)

试试这个:

UIViewController *myController = [[[MyViewController alloc] init] autorelease];
UIViewAnimationTransition transition = UIViewAnimationTransitionCurlUp; // or whatever effect you want
[UIView beginAnimations:nil context:nil];
[UIView setAnimationTransition:transition forView:[self window] cache:YES];
[navController presentModalViewController:myController animated:NO]; // or dismissModalViewController in your case
[UIView commitAnimations];

答案 1 :(得分:0)

我想我明白了。我按照以下示例进行了操作:

http://developer.apple.com/library/ios/#samplecode/BubbleLevel/Introduction/Intro.html

基本上从superview中删除了第二个视图,并将第一个视图重新插入。转换在词之后正常工作。

谢谢你的帮助。