도래울

ios get the previous viewcontroller that pushed my current view 본문

개발/iOS

ios get the previous viewcontroller that pushed my current view

도래울 2016. 7. 15. 10:22

objective c

NSLog(@"%@",[self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-2]);




swift 

let n: Int! = self.navigationController?.viewControllers?.count
let myUIViewController = self.navigationController?.viewControllers[n-2] as! UIViewController


Comments