1.代碼方式跳轉
/** 取出 storyboard 中 ID 為"edit"的控制器*/
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
XBEditViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"edit"];
/** 向控制器傳遞數據 */
vc.contact = self.contacts[indexPath.row];
vc.block = ^{
[self.tableView reloadData];
};
/** 壓棧跳轉控制器 */
[self.navigationController pushViewController:vc animated:YES];
2. storyboard連線跳轉方式,根據綁定的 ID 進行控制器跳轉
[ self ?performSegueWithIdentifier:@"jumpToContact" ?sender:nil ];
然后系統會調用
- (void)prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender
3. 模態彈出的
- (void)presentViewController:(UIViewController*)viewControllerToPresent animated: (BOOL)flag completion:(void(^)(void))completion
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void(^)(void))completion;