我想知道是否有可能将导航控制器动画更改为某个地方,而不是只是滑动到视图上的新视图,当新视图滑动时当前视图会滑落...
我在这里有这个功能,它只是检测我的滑动,然后像普通的导航控制器一样动画视图..但我希望我能在你的帮助下找出其他的东西。
// Need to change this to work with viewArray
- (void)swipedScreen:(UISwipeGestureRecognizer*)gesture {
//Left swipe
if (gesture.direction == UISwipeGestureRecognizerDirectionLeft)
{
if (viewCount == 0)
{
viewCount += 1;
// Load a detial view into the (sub)NavController
DetailViewControllerA *detailViewA = [[DetailViewControllerA alloc] initWithNibName:@"DetailViewControllerA" bundle:[NSBundle mainBundle]];
[otherNav pushViewController:detailViewA animated:YES];
}
}
//Right swipe
else if (gesture.direction == UISwipeGestureRecognizerDirectionRight)
{
if (viewCount == 1)
{
viewCount -= 1;
[self.otherNav popViewControllerAnimated:YES];
}
}
}
答案 0 :(得分:1)
您可以使用uiView动画块执行此操作,我用它来显示一个闪烁的UIView
[UIView animateWithDuration:1.0
delay:0.0
options:UIViewAnimationCurveEaseInOut
animations:^ {
self.splash.alpha = 0.2;
}
completion:^(BOOL finished) {
[UIView animateWithDuration:1.0 animations:^{
self.splash.alpha = 1.0;
}];
}];
或
使用以下代码
[UIView beginAnimations:nil context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.window cache:YES];
[UIView setAnimationDuration:0.75];
[UIView setAnimationDelegate:self];
[self.splash removeFromSuperview];
[UIView commitAnimations];
用于翻转过渡
并且用于更改推/动画动画我使用此代码
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController:self.detailViewController animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
享受Codding:)
Happy Codding:)