How to call a method from another class

Hello everyone.


I have 2 classes.

  1. ViewController1
  2. ViewController2


In ViewController1 I have a method:

- (void)hideBirthFrameOutlet2
  {
    self.BirthFrameOutlet2.hidden = YES;
  }




I want to call my hideBirthFrameOutlet2 method from outside my ViewController1 class. I want to call it from within ViewController2 from within this method:

- (IBAction)goBackToPage1:(id)sender
  {
    // put the code right here 
    [self.navigationController popViewControllerAnimated:YES];
  }




I have found lots of examples in stack overflow on how to do this and for the last 3 days I have been attempting call my hideBirthFrameOutlet2 method from outside my ViewController1 class. It should be simple.


I am aware that I should #import ViewController1.h into ViewController2.h right under the other imports and I have but I just can't get it to work. I know what I am attempting is a very doable.


Can someone here help me out on this?


JR

Yes. Any time you see this inside a function or method (not in a header file):

TypeName *variableName...

you're creating a local variable. It's only used in the chunk of code where it's declared, and the memory used to reference the object is released once that code is done. It's perfect for quick interaction.


You know what the * means, right?

How to call a method from another class
 
 
Q