-3

How does iOs know?

Does each view has a pointer to it's controller?

What happened?

When we pop a viewController from navigation, does the navigationController arrange which view should be called?

For example:

If I added:

 [[BNUtilitiesQuick window] addSubview:[BNUtilitiesQuick searchController].view];

viewWillAppear will be called.

ios does know which viewControler viewwillappear should be called even under cases in the question. There is no way I can think of how they know that without a pointer from view to viewcontroller.

However, window doesn't know the viewController. I am passing the view outlet of the controller not the controller. How can iOs 5 knows that it has to call [[BNUtilitiesQuick searchController] viewWillAppear:YES]

user4951
  • 32,206
  • 53
  • 172
  • 282
  • downvotes, no comments, :( By the way, ios does know which viewControler viewwillappear should be called even under cases in the question. There is no way I can think of how they know that without a pointer from view to viewcontroller. The answer below doesn't address that. – user4951 Jul 02 '12 at 08:22

1 Answers1

1

Navigation Controller maintains a stack of view controllers.

Once a view controller is popped, it is removed from the stack, and now the view controller exactly below this is the first view controller.This is how it works.

You can check documentation for more details - http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007457

http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/NavigationControllers.html#//apple_ref/doc/uid/TP40011313-CH2

rishi
  • 11,779
  • 4
  • 40
  • 59