单击“返回”时阻止动画导航栏中的按钮? [英] Prevent the animation when clicking "Back" button in a navigation bar?

查看:163
本文介绍了单击“返回”时阻止动画导航栏中的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有一个导航控制器,我不想要任何动画:

My application has a navigation controller and I don't want any animation in it :


  • 以防止动画时通过pushViewController:animated:method

  • 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

这篇关于单击“返回”时阻止动画导航栏中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆