0
A
回答
0
当你出现在UINavigationController
,想必在你的应用程序的委托,使应用程序的委托也是导航控制器的委托。然后查看被弹出并推视图控制器:
AppController.h
#import <UIKit/UIKit.h>
@interface AppController.h : NSObject
<UIApplicationDelegate, UINavigationControllerDelegate>
{
UIWindow *window;
UINavigationController *viewController;
}
/* MARK: Interface Outlets */
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *viewController;
@end
AppController.h
#import "AppController.h"
@implementation AppController.h
/* MARK: Init and Dealloc */
- (void)dealloc {
self.window = nil;
self.viewController = nil;
[super dealloc];
}
/* MARK: Interface Outlets */
@synthesize window, viewController;
/* MARK: Application Delegate */
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
assert(self.window != nil);
assert(self.viewController != nil);
self.viewController.delegate = self;
/* other initialization */
[self.window makeKeyAndVisible];
return YES;
}
/* MRK: Navigation Controller Delegate */
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)vc
animated:(BOOL)animated
{
UIBarButtonItem *myItem = /* initialize */;
navigationController.topViewController.navigationItem.backBarButtonItem = nil;
navigationController.topViewController.navigationItem.backBarButtonItem = myItem;
}
@end
此外,还可以通过检查阉-[NSObject isKindOfClass:]
忽略自定义视图控制器匹配想要的视图控制器。
0
从http://osmorphis.blogspot.com/2009/03/trapping-uinavigationbar-back-button.html
您可以在标准的后退按钮更改的唯一事情是文本。默认情况下,这是控制器的标题。你可以用这样的代码更改:
[self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"New Title" style:UIBarButtonItemStyleBordered target:nil action:nil];
只需更换
initWithTitle:@"New Title"
与
initWithTitle:@"Back"
0
试着问问题之前,进行搜索。
似乎您可以将以下代码添加到调用钻取的控制器,即master-detail中的主控。
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
感谢iPhoneGuy这里:iPhone Dev SDK
相关问题
- 1. 默认导航栏颜色
- 2. 使用引导程序默认导航栏破损的图像
- 3. 恢复默认的导航栏外观
- 4. 如何覆盖“默认”导航栏?
- 5. Lollipop中导航栏的默认Alpha值
- 6. 集导航栏恢复为默认
- 7. 默认导航栏高度ios
- 8. 更改导航栏的默认颜色
- 9. 如何编辑默认导航栏?
- 10. 奇怪的默认导航栏对齐
- 11. 默认iPhone的UIColor导航栏
- 12. 使用引导默认导航栏,“切换导航”按钮无响应
- 13. 导航栏文本使用温泉UI
- 14. 如何使用Reactstrap具有默认折叠导航栏?
- 15. 如何获取导航栏中使用的默认图像?
- 16. 在Bootstrap3中使用折叠的导航栏作为默认值
- 17. 如何设置默认的导航栏的颜色,文本颜色为所有视图控制器导航栏
- 18. 引导默认导航栏下拉不起作用
- 19. HTML文本导航栏
- 20. iOS文本导航栏
- 21. I18n单击导航栏链接默认返回英文
- 22. 如何拥有两个导航栏?一个使用默认的引导程序导航栏和该导航栏下的另一个标题栏
- 23. 导航栏品牌文本流出导航栏
- 24. 默认情况下关闭引导程序的导航栏
- 25. 认证和导航栏
- 26. 如何禁用Iphone SDK导航栏中的默认leftbarbutton?
- 27. 引导导航栏的文本颜色
- 28. 文本在Twitter的引导导航栏
- 29. 隐藏导航控制器中的默认导航栏在ios 5
- 30. 引导默认的导航栏比它应该默认情况下更小,即使在全新安装