1.使用的类 UINavigationController
2.UINavigationController有两个重要的方法
1)- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; (通过导航控制器跳到下一个页面)
2)- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
(通过导航控制器返回上一个页面)
3.初始化一个导航控制器 设置导航控制器的第一个页面
UINavigationController *nv = [[UINavigationController alloc]initWithRootViewController:viewController];
把nv当做根视图控制器
self.window.rootViewController = nv;
4.title设置导航栏的标题 如:设置标题为主页
self.title = @“主页”;
5.在跳转页面后 如果跳到的这个页面没有设置背景颜色 就会出现 push卡顿的现象
自己书写扩展栏上的按钮
1.扩展栏上的按钮
UIBarButtonItem *left = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(back)];
2.tintColor 设置BarButtonItemd颜色
,left.tintColor = [UIColor blueColor];
3.设置导航栏上面的内容 设置内容里面 左侧按钮的属性
self.navigationItem.leftBarButtonItem = left;