我有一个按钮'过滤器'在左侧的导航栏。在点击它,我想翻转动画与翻转延迟1.5秒,同时切换到下一个视图。如何添加代码呢?
我正在使用这个导航代码:
FilterViewController *vc = [[FilterViewController alloc] init];
vc.delegate = self;
[self.delegate pushViewController:vc animated:UIViewAnimationTransitionFlipFromLeft];
[vc release];
现在我想要一个1.5秒的翻转延迟在视图切换按钮。我已经尝试了一些代码,但它没有给我想要的结果。
试试这个
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:vc animated:YES];
[UIView commitAnimations];
[vc release];
取自如何在点击信息按钮时在两个uiviewcontroller之间翻转动画?
其他方式:
MainView *nextView = [[MainView alloc] init];
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[super pushViewController:nextView animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
}];
我从如何在基于导航的应用程序中更改Push和Pop动画
使用这个来延迟推送动画:
FilterViewController *vc = [[FilterViewController alloc] init];
vc.delegate = self;
[self performSelector:@selector(callViewController:) withObject:vc afterDelay:1.5];
-(void)callViewController:(FilterViewController*)vc{
[self.delegate pushViewController:vc animated:UIViewAnimationTransitionFlipFromLeft];
[vc release];
}