user740413
user740413

Reputation: 41

SplitViewController

Can I call detailViewController methods or get attributes declared as IBOutlets by me in the class, from another rootViewController that I have created?

I have this hierarchy of rootControlViews:

[RootViewController]
    [Cell 1] -> [Cell1RootViewController] (push Cell1RootView... into the navController]

Only one DetailViewController with an IBOutlet declared object (and synthethised) called object.

I select the [Cell 1], So I am now inside Cell1RootViewController. How can I call the object declared in DetailViewController from here?.

I have tried declaring it inside Cell1RootViewController and tried linking it by reference outlet with the one that is inside DetailViewController, but it didn't work.

Upvotes: 0

Views: 337

Answers (1)

user740413
user740413

Reputation: 41

If you have a SplitViewController, then you have a MasterView and a ControllerView (that extends/implements TableDataSource and TableDelegate protocols).

If you wanted to have several ControllerViews because of something, and wanted to call MasterView methods when inside of any ControllView of yours, you should have an INIT method like this:

- (id) initWithMasterView: (MasterView *) theMaster, ....otherOptionsYouWant{
       self = [super init]
       if (self){ 
               myMasterInstance = theMaster;
               //other initializations you want here
       }
       return self;
}

Upvotes: 2

Related Questions