iOS navigation geekband

创建:
-initWithrootviewController:
-initWithNavigationBarClass:toolbarClass;
-setViewControllers:animated;

 例子
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.

self.window.backgroundColor = [UIColor whiteColor];
RoowViewController *root = [[RoowViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:root];//先将root添加在navigation上
self.window.rootViewController = nav;//navigation加在window上

self.window.backgroundColor = [UIColor blueColor];
[self.window makeKeyAndVisible];
return YES; }
iOS navigation geekband_第1张图片
创建
 设置属性:
self.navigationItem.title = @"主页";//设置navigationbar上显示的标题
[self.navigationController.navigationBar setTranslucent:NO];//设置navigationbar的半透明
[self.navigationController.navigationBar setBarTintColor:[UIColor redColor]];//设置navigationbar的颜色
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:Nil];//设置navigationbar左边按钮
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:Nil];//设置navigationbar右边按钮
[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];//设置navigationbar上左右按钮字体颜色
iOS navigation geekband_第2张图片
设置
 toolbar
//toolbar 加载 一般为隐藏
[self.navigationController  setToolbarHidden:NO animated:YES];
UIBarButtonItem *one = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];
UIBarButtonItem *two = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:nil action:nil];
UIBarButtonItem *three = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil];
UIBarButtonItem *four = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:nil action:nil];
UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[self setToolbarItems:[NSArray arrayWithObjects:flexItem, one, flexItem, two, flexItem, three, flexItem, four, flexItem, nil]];
iOS navigation geekband_第3张图片
toolbar

Navigation bar


iOS navigation geekband_第4张图片
Navigation bar

UINavigationController


iOS navigation geekband_第5张图片
UINavigationController

NavController


iOS navigation geekband_第6张图片
NavController

引入导航器


iOS navigation geekband_第7张图片
引入导航器

你可能感兴趣的:(iOS navigation geekband)