天天看點

[ios]多個storyboard跳轉

1、單個storyboard跳轉

UIStoryboard *board = self.storyboard;
                HomeController *homevc = [board instantiateViewControllerWithIdentifier:@"homevc"];
                [self.navigationController pushViewController: homevc animated:YES];      

2.多個:

UIStoryboard *board = [UIStoryboard storyboardWithName:@"Login" bundle:nil];
LoginController *loginvc = [board instantiateViewControllerWithIdentifier:@"loginvc"];
[self.navigationController pushViewController: loginvc animated:YES];      

PS:在有多個storyboard的情況下,都要替換成這種聲明方式

*不同跳轉方式:

//Modal方式
 
 
 
[self presentModalViewController:my_device_vc animated:YES];
  //使用了navitgation 
 
[self.navigationController pushViewController: loginvc animated:YES];
   
 
 //回退
 
 
[self.navigationController popViewController animated:YES];      
let bookDateVC = UIStoryboard(name: "Book-date", bundle: nil).instantiateViewController(withIdentifier: "book-date")
bookDateVC.title = "預約日期及時間"
self.navigationController?.pushViewController(bookDateVC, animated: true)