iOS中的控制器有三種建立方式:app
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Apply" bundle:nil]; SchemeViewController *schemeVC = [storyboard instantiateViewControllerWithIdentifier:@"SchemeViewController"];
YFViewController *mj = [[YFViewController alloc] initWithNibName:@"YFViewController" bundle:nil];
YFViewController *mj = [[YFViewController alloc] init];
- (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; UIBarButtonItem *rightBarButtonItem //右上角的視圖 @property(nonatomic,retain) UIBarButtonItem *rightBarButtonItem;