views:

29

answers:

1

Hi, i've got a problem:

lets say i have two view controllers, firstViewController and secondViewController. The firstViewController is supposed to present the secondViewController and i also want to access a bunch of methods and properties from the secondViewController through the firstViewController.

I do this by simply using the import tag in the header file of the firstViewController and i simply import the secondViewController into the firstViewController.

But now i also want it work the other way around. I want to access some methods or other things from the firstViewController through the secondViewController. When i also import the firstViewController into the secondViewController it just does not work for some reason.

Why is that? And does anybody know a solution to that problem? Thanks in advance!

A: 

The solution is easy. Put this line in your header file below the import but above the secondViewController declare

#import "something"

@class firstViewController;

@interface secondViewController : UIViewController {
 firstViewController *firstVC;
}
vodkhang
do i also "import" the firstViewController or do i just add the @class tag?
Christoph v
one of them you have to import and the other you have to @class. The problem is the cyclic import that Xcode doesn't understand how to solve
vodkhang