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
这篇关于单击“返回"时阻止动画;导航栏中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:单击“返回"时阻止动画;导航栏中的按钮?
基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01
