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
这篇关于单击“返回"时阻止动画;导航栏中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:单击“返回"时阻止动画;导航栏中的按钮?


- 网上有没有好的 UIScrollView 教程? 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- UITextView 内容插图 2022-01-01
- URL编码Swift iOS 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01