views:

27

answers:

1

So essentially I'm inserting "startViewController" into "mainViewController" now of course I can access startViewControllers methods from mainViewController but I was wondering how to do the opposite? Occasionally startViewController will need to call something in mainViewController and I was just wondering how I do this?

Thanks in advance.

+2  A: 

Add an ivar of your mainViewController to your startViewController and set this when showing the view.

Or you can design a nice clean protocol, and make one view the delegate of the other.

Eiko
Thanks! I've never heard of this solution before. Any tips on how to go about doing it?
Jeff
Add a variable in your StartViewController.h file, make it a property and set it somewhen :-)
Eiko
So presumably I do this?startViewController.h:"mainViewController *variable;@property (nonatomic,retain) mainViewController *variable"startViewController.m:"#import "mainViewController.h"@synthesize variable;[variable method];"
Jeff