I have a protocol that my ApplicationDelegate implements. I want to pass this to the first view controller defined in a story board. How do I get access to it from the method?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Specifying the Initial View ControllerOpen Main. storyboard and select the Tab Bar Controller Scene. On the right, select the Attribute inspector. You'll find a checkbox named Is Initial View Controller.
Right-click the control or object in your current view controller. Drag the cursor to the view controller you want to present. Select the kind of segue you want from the list that Xcode provides.
I am not sure if I am understanding the question correctly I think you are asking how do you get the first viewController in a storyboard. To get this you call,
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc =[storybord instantiateInitialViewController];
Change the name of the storyboard to suit your name, MainStoryboard is just the default name. Hope this is what you were looking for.
Edit:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc =[storybord instantiateInitialViewController];
//set the delegate on the view controller that you have loaded
// Override point for customization after application launch.
return YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With