0
我创建了一个基于视图的应用程序。我在视图和两个按钮上放置了一个导航栏。我想在按下按钮后更改导航栏的标题。在IB中,我已将按钮与相应的操作相连接。调试显示操作正在调用,但导航栏的标题未更改。更改UINavigationBar的标题
请帮忙!
//
// NavBarViewController.h
#import <UIKit/UIKit.h>
@interface NavBarViewController : UIViewController {
}
-(IBAction) clickedOne: (id)sender;
-(IBAction) clickedTwo: (id)sender;
@end
//
// NavBarViewController.m
#import "NavBarViewController.h"
@implementation NavBarViewController
-(IBAction) clickedOne: (id)sender {
self.navigationItem.title = @"1";
}
-(IBAction) clickedTwo: (id)sender {
self.navigationItem.title = @"2";
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
请使用标签来说明这个问题涉及到哪些技术。如果您使用现有的标签(例如Php,.net等 – NiladriBose