Stopping the initial storyboard viewcontroller being created
Stopping the initial storyboard viewcontroller being created
- Subject: Stopping the initial storyboard viewcontroller being created
- From: Roland King <email@hidden>
- Date: Thu, 26 Nov 2015 21:27:36 +0800
I would like to create the main viewcontroller in my applicationDidFinishLaunching:withOptions: method (iOS) instead of having the storyboard one created automatically.
I’m doing this in order to change behaviour between simulator and device as the simulator doesn’t support BlueTooth, so I need to fix in a simulated version.
I have the code to create the initial view controller and fix it up
let storyboard = UIStoryboard(name: "Main", bundle: nil)
self.window?.rootViewController = storyboard.instantiateInitialViewController()
// make a fix to the viewcontroller here
self.window?.makeKeyAndVisible()
however I’ve found that standard machinery still creates one for me so I end up with two of them, possibly with the one I want on-screen, possibly not, and the first one created doesn’t do the decent thing and release itself either, so two of them persist. (I don’t understand what’s referencing it either, when I assign to the rootViewController it ought to go away but doesn’t).
How do I stop the standard storyboard initial viewcontroller load so I can do it myself.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden