- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
//使用pop方法可以移除控制器
//将栈顶的控制器移除
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
//回到指定的子控制器
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
//回到根控制器(栈底控制器)
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
UINavigationItem有以下属性影响着导航栏的内容
//左上角的返回按钮
@property(nonatomic,retain) UIBarButtonItem *backBarButtonItem;
//中间的标题视图
@property(nonatomic,retain) UIView *titleView;
//中间的标题文字
@property(nonatomic,copy) NSString *title;
//左上角的视图
@property(nonatomic,retain) UIBarButtonItem *leftBarButtonItem;
UIBarButtonItem *rightBarButtonItem
//右上角的视图
@property(nonatomic,retain) UIBarButtonItem *rightBarButtonItem;
// 清空导航条背景图片,系统判断当前是否为Nil,如果为nil,系统还是会自动生成一张背景图片
[self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
//每一个Segue对象,都有3个属性
//唯一标识
@property (nonatomic, readonly) NSString *identifier;
//来源控制器
@property (nonatomic, readonly) id sourceViewController;
//目标控制器
@property (nonatomic, readonly) id destinationViewController;
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender;
// 这个sender是当初performSegueWithIdentifier:sender:中传入的sender
//以Modal的形式展示控制器
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion
关闭当初Modal出来的控制器
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion;
//如果一个控制器的View显示在界面上,一定要把这个控制器强引用
//1. 首先创建一个当前控制器将要跳转到的控制器
YLViewController *VC = [[YLViewController alloc] init];
//2.把Modal的控制器的View添加到窗口上,把之前的窗口上的View移除
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
[keyWindow addSubview:VC];
//3.改形变属性,控制一个控件的位置(translation),尺寸(scale),角度(rotation)
VC.view.transform = CGAffineTransformMakeTranslation(0,self.view.bounds.size.height);
//4.动画向上推出
[UIView animateWithDuration:0.5 animations:^{
//CGAffineTransformIdentity:形变全部清空
VC.view.transform = CGAffineTransformIdentity;
}completion:^(BOOL finished){
[self.view removeFromSuperview];
}];