Prevent the animation when clicking quot;Backquot; button in a navigation bar?(单击“返回时阻止动画;导航栏中的按钮?)
问题描述
我的应用程序有一个导航控制器,我不希望它有任何动画:
My application has a navigation controller and I don't want any animation in it :
要在推送视图时阻止动画,很简单,通过 pushViewController:animated: 方法
to prevent an animation when pushing a view, it's easy, via the pushViewController:animated: method
但是当我点击这个子视图上的返回"按钮时,有一个动画!KO!我可以做些什么来阻止这个动画?
but when I click the "back" button on this subview, there's an animation ! KO ! What can I do to prevent this animation ?
推荐答案
更优雅的一个类别.这假设您在应用程序委托中设置了导航控制器对象.只需将其放在根视图控制器中的 @implementaion 之前即可.
More elegant with a category. This assumes you navigation controller object is set in your app delegate. Just put this before your @implementaion in the root view controller.
#import "AppDelegate.h"
@implementation UINavigationBar (custom)
- (UINavigationItem *)popNavigationItemAnimated:(BOOL)animated;
{
AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.navController popViewControllerAnimated:NO];
return TRUE;
}
@end
这篇关于单击“返回"时阻止动画;导航栏中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:单击“返回"时阻止动画;导航栏中的按钮?


基础教程推荐
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01