views:

66

answers:

1

Hi everyone,

When I pushed a controller, is there a way to get the controller which pushed it (without sending it)? Or the first one?

Thanks

+2  A: 

You can get all view controllers from navigationController.viewControllers property. And the controller which pushed the currently visible controller is [navigationController.viewControllers objectAtIndex:[navigationController.viewControllers count] - 2].

Skie
Caveat: not all apps have a UINavigationController. In any case, can't you get which controller pushed you directly thru the parentViewController property?
progrmr