我想添加一些按钮到我的导航控制器的工具栏:我看到工具栏,但没有按钮。这是我的代码,我设置工具栏部分...导航控制器工具栏按钮问题 - Xcode
(这是我的AppDelegate)
// Create a table view controller
RootViewController *rootViewController = [[RootViewController alloc]
initWithStyle:UITableViewStyleGrouped];
rootViewController.managedObjectContext = context;
rootViewController.entityName = @"County";
//Navigation Controller
UINavigationController *aNavigationController = [[UINavigationController alloc]
initWithRootViewController:rootViewController];
self.navigationController = aNavigationController;
//Barbuttons
UIBarButtonItem *homeButton;
homeButton = [[[UIBarButtonItem alloc] initWithTitle:@" Inizio " style:UIBarButtonItemStyleBordered target:self action:@selector(home)] autorelease];
UIBarButtonItem *barButton;
barButton = [[[UIBarButtonItem alloc] initWithTitle:@" Funzioni online " style:UIBarButtonItemStyleBordered target:self action:@selector(caricamappa)] autorelease];
UIBarButtonItem *creditsButton;
creditsButton = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"credits2.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(credits)] autorelease];
NSArray *baritems = [NSArray arrayWithObjects: homeButton, barButton, creditsButton, nil];
[window addSubview:[navigationController view]];
[self.navigationController.toolbar setItems:baritems];
[self.navigationController setToolbarHidden:NO];
[window makeKeyAndVisible];
[rootViewController release];
[aNavigationController release];
关于我的错误任何想法?