http://blog.csdn.net/u010229677白白手游专栏
使用:
ViewController* vc = [[ViewController alloc] init];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[self.navigationController pushViewController:xxx animated:YES];
[self.navigationController popViewControllerAnimated:YES];
self.title = @"标题";
//设置背景颜色,下面三句话
self.navigationController.navigationBar.backgroundColor = [UIColor blueColor];
self.navigationController.navigationBar.translucent = YES; //设置背景为透明的
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.tintColor = [UIColor blueColor]; //设置按钮颜色
//手动添加左右两个按钮,若不添加,左按钮自动生成,带有返回图标和上一个界面的标题
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Exit" style:UIBarButtonItemStylePlain target:self action:@selector(handleExit:)];
self.navigationItem.leftBarButtonItem = backButton;
UIBarButtonItem *setButton = [[UIBarButtonItem alloc] initWithTitle:@"设置" style:UIBarButtonItemStylePlain target:self action:@selector(setButtonAction:)];
self.navigationItem.rightBarButtonItem = setButton;