How to change the Push and Pop animations in a navigation based app
来源:互联网 发布:大魔王ba淘宝买靠谱吗 编辑:程序博客网 时间:2024/06/07 15:00
I have a navigation based application and I want to change the animation of the push and pop animations. How would I do that?
========
This is how I've always managed to complete this task.
For Push:
MainView *nextView=[[MainView alloc] init];[UIView beginAnimations:nil context:NULL];[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];[UIView setAnimationDuration:0.75];[self.navigationController pushViewController:nextView animated:NO];[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];[UIView commitAnimations];[nextView release];
For Pop:
[UIView beginAnimations:nil context:NULL];[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];[UIView setAnimationDuration:0.75];[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];[UIView commitAnimations];[UIView beginAnimations:nil context:NULL];[UIView setAnimationDelay:0.375];[self.navigationController popViewControllerAnimated:NO];[UIView commitAnimations];
another solution
I did the following and it works fine.. and is simple and easy to understand..
CATransition* transition = [CATransition animation];transition.duration = 0.5;transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];transition.type = kCATransitionFade; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade//transition.subtype = kCATransitionFromTop; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom[self.navigationController.view.layer addAnimation:transition forKey:nil];[[self navigationController] popViewControllerAnimated:NO];
this really is the most sane solution. Just a minor note for future visitors: the
Animated:NO
part is vital. If YES
is passed, the animations mix and cause funny effects. Best solution so far.. And for the beginners, don't forget to include QuartCore (#import <QuartzCore/QuartzCore.h>)
- How to change the Push and Pop animations in a navigation based app
- How To Create A Socket Based iPhone App and Server
- How to hide and show elements based on a Content Control value change?
- How to change the price range in layered navigation in Magento? - See more at: http://www.expertweba
- How to change the timeout in FXCop
- How To Use Animations and Sprite Sheets in Cocos2D
- How to Change the Text in the Tabs of a CPropertySheet
- Networking Tutorial for iOS: How To Create A Socket Based iPhone App and Server
- How to Change the Order Increment ID and Prefix in Magento
- How to change a file's owner and group in Linux - 1.0(翻译)
- How to change the ForeColor of individual items in a ComboBox? (C# Winforms)
- How To Query And Change The Oracle Hidden Parameters In Oracle 10g and 11g (文档 ID 315631.1)
- How to change mode from c++98 mode in Dev-C++ to a mode that supports C++0x (range based for)?
- How to show/hide a control in the Column's DataItemTemplate based on the value of another control
- Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your a
- How to Change The Bootsplash In Ubuntu 8.10
- How to change the character case in ksh?
- How to change the font size in legend of matlab
- cluster_database false or ture - ORA-01102
- java-jdk环境变量配置
- Flash Player Debugger下载(9/10版本)
- ExecuteNonQuery()方法和ExecuteScalar()方法区别
- StringTokenizer(字符串分隔解析类型)
- How to change the Push and Pop animations in a navigation based app
- Difference for LIOT and SIOT
- unresolved external symbol _main
- 关于搜索框设计技巧
- 常用的安全CRT函数
- Android复写BaseAdapter并显示ListView视图
- 工欲善其事,必先利其器
- Flex3 实战 10章 事件
- C_字符串 PK string