user689751
user689751

Reputation:

XCode Storyboard How to access all view controllers inside the storyboard

In a Single View Application, Inside the storyboard if I've multiple view controllers with different classes assigned to them,

How can I access all of them inside AppDelegate while still know what kind (Class) of ViewController is this?

for instance root view controller I can access

BlackTimer *vc = (BlackTimer *)_window.rootViewController;

how about the other sibling view controllers?

Upvotes: 0

Views: 795

Answers (1)

TeaCupApp
TeaCupApp

Reputation: 11452

Create iVar of your sibling UIViewControllers inside your app delegate and later whenever you invoke a view controller you alloc init the ivar which is inside app delegate. You can get reference to app delegate from anywhere by using

[UIApplication sharedApplication] delegate];

Upvotes: 1

Related Questions