How do I transition my project from using a Storyboard to no longer using one?How to change the name of an iOS app?How do I sort an NSMutableArray with custom objects in it?Placeholder in UITextViewLoaded nib but the 'view' outlet was not setPassing Data between View ControllersProgrammatically set the initial view controller using StoryboardsHow to detect iPhone 5 (widescreen devices)?What are Unwind segues for and how do you use them?Xcode 6 Bug: Unknown class in Interface Builder fileHide strange unwanted Xcode logs
In the event of Brexit being postponed beyond the EU elections, will UK voters in EU countries be eligible to participate?
What properties make a magic weapon befit a Rogue more than a DEX-based Fighter?
Mac Mini (2018) 10Gb Port Compatibility
python displays `n` instead of breaking a line
Why is indicated airspeed rather than ground speed used during the takeoff roll?
Center page as a whole without centering each element individually
Would a primitive species be able to learn English from reading books alone?
Reason why a kingside attack is not justified
Calculate Pi using Monte Carlo
What is the period/term used describe Giuseppe Arcimboldo's style of painting?
What 1968 Moog synthesizer was used in the Movie Apollo 11?
Error in master's thesis, I do not know what to do
Why doesn't Gödel's incompleteness theorem apply to false statements?
Relations between homogeneous polynomials
Strange behavior in TikZ draw command
Why didn't Voldemort know what Grindelwald looked like?
What is this high flying aircraft over Pennsylvania?
How do I lift the insulation blower into the attic?
Checking @@ROWCOUNT failing
Started in 1987 vs. Starting in 1987
If the Dominion rule using their Jem'Hadar troops, why is their life expectancy so low?
Make a Bowl of Alphabet Soup
Travelling in US for more than 90 days
Why is participating in the European Parliamentary elections used as a threat?
How do I transition my project from using a Storyboard to no longer using one?
How to change the name of an iOS app?How do I sort an NSMutableArray with custom objects in it?Placeholder in UITextViewLoaded nib but the 'view' outlet was not setPassing Data between View ControllersProgrammatically set the initial view controller using StoryboardsHow to detect iPhone 5 (widescreen devices)?What are Unwind segues for and how do you use them?Xcode 6 Bug: Unknown class in Interface Builder fileHide strange unwanted Xcode logs
If I have an Xcode project that already uses a Storyboard, and now I want to switch to loading the view controller programmatically, how do I do that?
ios cocoa-touch uistoryboard
add a comment |
If I have an Xcode project that already uses a Storyboard, and now I want to switch to loading the view controller programmatically, how do I do that?
ios cocoa-touch uistoryboard
add a comment |
If I have an Xcode project that already uses a Storyboard, and now I want to switch to loading the view controller programmatically, how do I do that?
ios cocoa-touch uistoryboard
If I have an Xcode project that already uses a Storyboard, and now I want to switch to loading the view controller programmatically, how do I do that?
ios cocoa-touch uistoryboard
ios cocoa-touch uistoryboard
edited Mar 7 at 20:31
Josh Caswell
59.2k12131177
59.2k12131177
asked Mar 7 at 20:11
SensefulSenseful
46.5k44206325
46.5k44206325
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Here is an in-depth article about doing this. The TLDR is:
- In the project settings, clear the Main Interface:

In your
didFinishLaunchinguse code such as the following:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
window = UIWindow(frame: UIScreen.main.bounds)
let homeViewController = UIViewController()
homeViewController.view.backgroundColor = UIColor.red
window!.rootViewController = homeViewController
window!.makeKeyAndVisible()
return true
add a comment |
Slowly. One step at a time.
Storyboards are not all-or-nothing. You can continue to use a Storyboard for places where it is helpful, and you can use programmatic loading for places where it isn't, and you can transition between them one step at a time.
A first step if you wanted to unwind a piece from the Storyboard is to remove the segues leading in and out of it, and then programmatically load that view controller from the Storyboard with instantiateViewController(withIdentifier:).
You could then pull a given scene into its own separate Storyboard (select the scene, Editor, Refactor to Storyboard...) so that it's completely independent of all the other scenes. Then you can rework that one view controller as programmatic code without interrupting anything else in the project. You can also mix-and-match here; loading the view controller from the Storyboard, but handling initialization by hand in init(nibName:bundle:).
You can also cut and paste a storyboard view into its own XIB file, which sometimes is easier to work with, without giving up the GUI layout system. Select the view, copy, create a new XIB file (it's called "View" in the templates), and paste it. This is a bit easier to use with init(nibName:bundle:).
But the key point is to not try to rework your entire project all at once. If there's some portion where Storyboards are causing trouble, refactor them out. If you just like programmatic code better, then keep refactoring one step at a time until you're done or until you've done enough to be happy.
As Senseful's answer notes, the top-level scene is slightly special. You can change it with or without changing the other scenes.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052060%2fhow-do-i-transition-my-project-from-using-a-storyboard-to-no-longer-using-one%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is an in-depth article about doing this. The TLDR is:
- In the project settings, clear the Main Interface:

In your
didFinishLaunchinguse code such as the following:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
window = UIWindow(frame: UIScreen.main.bounds)
let homeViewController = UIViewController()
homeViewController.view.backgroundColor = UIColor.red
window!.rootViewController = homeViewController
window!.makeKeyAndVisible()
return true
add a comment |
Here is an in-depth article about doing this. The TLDR is:
- In the project settings, clear the Main Interface:

In your
didFinishLaunchinguse code such as the following:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
window = UIWindow(frame: UIScreen.main.bounds)
let homeViewController = UIViewController()
homeViewController.view.backgroundColor = UIColor.red
window!.rootViewController = homeViewController
window!.makeKeyAndVisible()
return true
add a comment |
Here is an in-depth article about doing this. The TLDR is:
- In the project settings, clear the Main Interface:

In your
didFinishLaunchinguse code such as the following:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
window = UIWindow(frame: UIScreen.main.bounds)
let homeViewController = UIViewController()
homeViewController.view.backgroundColor = UIColor.red
window!.rootViewController = homeViewController
window!.makeKeyAndVisible()
return true
Here is an in-depth article about doing this. The TLDR is:
- In the project settings, clear the Main Interface:

In your
didFinishLaunchinguse code such as the following:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
window = UIWindow(frame: UIScreen.main.bounds)
let homeViewController = UIViewController()
homeViewController.view.backgroundColor = UIColor.red
window!.rootViewController = homeViewController
window!.makeKeyAndVisible()
return true
answered Mar 7 at 20:11
SensefulSenseful
46.5k44206325
46.5k44206325
add a comment |
add a comment |
Slowly. One step at a time.
Storyboards are not all-or-nothing. You can continue to use a Storyboard for places where it is helpful, and you can use programmatic loading for places where it isn't, and you can transition between them one step at a time.
A first step if you wanted to unwind a piece from the Storyboard is to remove the segues leading in and out of it, and then programmatically load that view controller from the Storyboard with instantiateViewController(withIdentifier:).
You could then pull a given scene into its own separate Storyboard (select the scene, Editor, Refactor to Storyboard...) so that it's completely independent of all the other scenes. Then you can rework that one view controller as programmatic code without interrupting anything else in the project. You can also mix-and-match here; loading the view controller from the Storyboard, but handling initialization by hand in init(nibName:bundle:).
You can also cut and paste a storyboard view into its own XIB file, which sometimes is easier to work with, without giving up the GUI layout system. Select the view, copy, create a new XIB file (it's called "View" in the templates), and paste it. This is a bit easier to use with init(nibName:bundle:).
But the key point is to not try to rework your entire project all at once. If there's some portion where Storyboards are causing trouble, refactor them out. If you just like programmatic code better, then keep refactoring one step at a time until you're done or until you've done enough to be happy.
As Senseful's answer notes, the top-level scene is slightly special. You can change it with or without changing the other scenes.
add a comment |
Slowly. One step at a time.
Storyboards are not all-or-nothing. You can continue to use a Storyboard for places where it is helpful, and you can use programmatic loading for places where it isn't, and you can transition between them one step at a time.
A first step if you wanted to unwind a piece from the Storyboard is to remove the segues leading in and out of it, and then programmatically load that view controller from the Storyboard with instantiateViewController(withIdentifier:).
You could then pull a given scene into its own separate Storyboard (select the scene, Editor, Refactor to Storyboard...) so that it's completely independent of all the other scenes. Then you can rework that one view controller as programmatic code without interrupting anything else in the project. You can also mix-and-match here; loading the view controller from the Storyboard, but handling initialization by hand in init(nibName:bundle:).
You can also cut and paste a storyboard view into its own XIB file, which sometimes is easier to work with, without giving up the GUI layout system. Select the view, copy, create a new XIB file (it's called "View" in the templates), and paste it. This is a bit easier to use with init(nibName:bundle:).
But the key point is to not try to rework your entire project all at once. If there's some portion where Storyboards are causing trouble, refactor them out. If you just like programmatic code better, then keep refactoring one step at a time until you're done or until you've done enough to be happy.
As Senseful's answer notes, the top-level scene is slightly special. You can change it with or without changing the other scenes.
add a comment |
Slowly. One step at a time.
Storyboards are not all-or-nothing. You can continue to use a Storyboard for places where it is helpful, and you can use programmatic loading for places where it isn't, and you can transition between them one step at a time.
A first step if you wanted to unwind a piece from the Storyboard is to remove the segues leading in and out of it, and then programmatically load that view controller from the Storyboard with instantiateViewController(withIdentifier:).
You could then pull a given scene into its own separate Storyboard (select the scene, Editor, Refactor to Storyboard...) so that it's completely independent of all the other scenes. Then you can rework that one view controller as programmatic code without interrupting anything else in the project. You can also mix-and-match here; loading the view controller from the Storyboard, but handling initialization by hand in init(nibName:bundle:).
You can also cut and paste a storyboard view into its own XIB file, which sometimes is easier to work with, without giving up the GUI layout system. Select the view, copy, create a new XIB file (it's called "View" in the templates), and paste it. This is a bit easier to use with init(nibName:bundle:).
But the key point is to not try to rework your entire project all at once. If there's some portion where Storyboards are causing trouble, refactor them out. If you just like programmatic code better, then keep refactoring one step at a time until you're done or until you've done enough to be happy.
As Senseful's answer notes, the top-level scene is slightly special. You can change it with or without changing the other scenes.
Slowly. One step at a time.
Storyboards are not all-or-nothing. You can continue to use a Storyboard for places where it is helpful, and you can use programmatic loading for places where it isn't, and you can transition between them one step at a time.
A first step if you wanted to unwind a piece from the Storyboard is to remove the segues leading in and out of it, and then programmatically load that view controller from the Storyboard with instantiateViewController(withIdentifier:).
You could then pull a given scene into its own separate Storyboard (select the scene, Editor, Refactor to Storyboard...) so that it's completely independent of all the other scenes. Then you can rework that one view controller as programmatic code without interrupting anything else in the project. You can also mix-and-match here; loading the view controller from the Storyboard, but handling initialization by hand in init(nibName:bundle:).
You can also cut and paste a storyboard view into its own XIB file, which sometimes is easier to work with, without giving up the GUI layout system. Select the view, copy, create a new XIB file (it's called "View" in the templates), and paste it. This is a bit easier to use with init(nibName:bundle:).
But the key point is to not try to rework your entire project all at once. If there's some portion where Storyboards are causing trouble, refactor them out. If you just like programmatic code better, then keep refactoring one step at a time until you're done or until you've done enough to be happy.
As Senseful's answer notes, the top-level scene is slightly special. You can change it with or without changing the other scenes.
answered Mar 7 at 20:43
Rob NapierRob Napier
205k28303431
205k28303431
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052060%2fhow-do-i-transition-my-project-from-using-a-storyboard-to-no-longer-using-one%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown