Question

I was doing some iOS 5 tutorials and in several tutorials, it says things like "Add at end of viewWillAppear" or "Modify viewWillDisappear" in MasterViewController.m but in my project, MasterViewController.m does not have any of those methods.

Since it doesn't say "create those methods", I'm guessing they are automatically created by something but I do not know what I need to do to make them appear in MasterViewController.m.

Please somebody help me?

Was it helpful?

Solution

These methods are typically inherited from a parent class (e.g., UIViewController). What you probably should do is add something like

- (void)viewWillAppear:(BOOL)animated {
   [super viewWillAppear:animated];
   // Your new stuff here
}

The method prototype was taken from Apple's documentation of UIViewController; depending on the class you're subclassing (the thing after the colons in the .h file, in the @interface line) you might need different method prototypes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top