控制器管理
MJViewController *mj = [[MJViewController alloc] init];
MJViewController *mj = [[MJViewController alloc] initWithNibName:@"MJViewController" bundle:nil];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Test" bundle:nil];
MJViewController *mj = [storyboard instantiateInitialViewController];
MJViewController *mj = [storyboard instantiateViewControllerWithIdentifier:@”mj"];
property(nonatomic,copy) NSArray *viewControllers;
property(nonatomic,readonly) NSArray *childViewControllers;
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
@property(nonatomic,retain) UIBarButtonItem *backBarButtonItem;
@property(nonatomic,retain) UIView *titleView;
@property(nonatomic,copy) NSString *title;
@property(nonatomic,retain) UIBarButtonItem *leftBarButtonItem;
@property(nonatomic,retain) UIBarButtonItem *rightBarButtonItem;
Storyboard上每一根用来界面跳转的线,都是一个UIStoryboardSegue对象(简称Segue)
@property (nonatomic, readonly) NSString *identifier;
@property (nonatomic, readonly) id sourceViewController;
@property (nonatomic, readonly) id destinationViewController;
手动型:需要通过写代码手动执行Segue,才能完成界面跳转
[self performSegueWithIdentifier:@"login2contacts" sender:nil];
// Segue必须由来源控制器来执行,也就是说,这个perform方法必须由来源控制器来调用
如果点击某个控件后,需要做一些判断,也就是说:满足一定条件后才跳转到下一个界面,建议使用“手动型Segue”
[self performSegueWithIdentifier:@“login2contacts” sender:nil];
// 这个self是来源控制器
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender;
// 这个sender是当初performSegueWithIdentifier:sender:中传入的sender
- (void)addChildViewController:(UIViewController *)childController;
@property(nonatomic,copy) NSArray *viewControllers;
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion;