? ? ? ? 有很多時候我們使用[self.navigationController popToViewController: [想返回的層級] animated:YES]; 想一次性返回兩級或三級怎么辦?看下面:
? ? ? ? 因?yàn)槊看蝡ush一個界面,系統(tǒng)都會把這一層級的ViewController保存到一個數(shù)組里,而self.navigationController.viewControllers正是系統(tǒng)存儲push后的VC數(shù)組。
? ? ? ? [self.navigationController popToViewController:self.navigationController.viewControllers[int] animated:YES];這樣寫pop我們就可以返回到指定的層級啦。(int是一個整型值,可以是1、2、3,看你要popTo哪一級)。
? ? ? ? 收工。